fork(1) download
  1. <?php
  2.  
  3. abstract class Employee
  4. { protected $rank;
  5. protected $rate;
  6. protected $profession;
  7. protected $isBoss;
  8.  
  9. abstract function getSalary();
  10. //abstract function getDrunkCoffee
  11. }
  12.  
  13. // Наследуем класс Аналитик
  14. class Analyst extends Employee
  15. {
  16.  
  17. public function getSalary(){}
  18.  
  19. }
  20.  
  21. $analyst = new Analyst;
  22. $analyst->rank = 2;
  23.  
  24. var_dump($analyst);
  25.  
  26. ?>
Runtime error #stdin #stdout #stderr 0.02s 82880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Uncaught Error: Cannot access protected property Analyst::$rank in /home/BsJOhE/prog.php:22
Stack trace:
#0 {main}
  thrown in /home/BsJOhE/prog.php on line 22