fork download
  1. <?php //департаменты и сотрудники
  2.  
  3.  
  4.  
  5.  
  6. class Company
  7. {
  8. private $name;
  9. private $departmentList = array();
  10.  
  11. public function __construct( $name )
  12. {
  13. $this->name = $name;
  14. }
  15. public function __clone()
  16. {
  17. foreach( $this->departmentList as $department )
  18. {
  19. $department = clone $department;
  20. }
  21. }
  22. }
  23.  
  24. class Department
  25. {
  26. protected $name;
  27. protected $workersList = array();
  28.  
  29. public function __construct( $name )
  30. {
  31. $this->name = $name;
  32. }
  33. public function __clone()
  34. {
  35. foreach( $this->workersList as $worker )
  36. {
  37. $worker = clone $worker;
  38. }
  39. }
  40. }
  41.  
  42. abstract class Worker
  43. {
  44. protected $rank;
  45. protected $isChief;
  46. protected $baseSalary;
  47. protected $coffeeConsumptionRate;
  48. protected $productionPerMount;
  49. }
  50.  
  51.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Standard output is empty