fork download
  1. <?php
  2.  
  3.  
  4. class Worker {
  5. public $name;
  6. public $level;
  7. public $chief;
  8. public $coffe;
  9. public $paid;
  10. public $pages;
  11.  
  12. public function drinkCoffe() {
  13. if ($this->chief) {
  14. return ($coffe *2);
  15. } else {
  16. return $coffe;
  17. }
  18. }
  19. }
  20. class Manager extends Worker {
  21. public function __construct($name, $level, $chief) {
  22. $this->name = $name;
  23. $this->level = $level;
  24. $this->chief = $chief;
  25. $this->coffe = 20;
  26. $this->paid = 500;
  27. $this->pages = 200;
  28. }
  29. }
  30. $stv = new Manager('Peter', 1, True);
  31. echo $stv->drinkCoffe();
  32. ?>
Success #stdin #stdout #stderr 0.01s 20568KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Notice:  Undefined variable: coffe in /home/mZDINN/prog.php on line 16