fork download
  1. <?php
  2.  
  3. abstract class Employee {
  4. abstract public $rang;
  5. abstract public $solary;
  6. abstract public $leader;
  7.  
  8. public function __construct($rang = 1, $leader = false) {
  9. $this->rang = $rang;
  10. $this->leader = $leader;
  11.  
  12. self::calculateSolary();
  13. }
  14.  
  15. public function calculateSolary() {
  16. switch ($this->rang) {
  17. case 2:
  18. $this->solary = $this->solary + ($this->solary * 0.25);
  19. break;
  20. case 3:
  21. $this->solary = $this->solary + ($this->solary * 0.50);
  22. break;
  23. }
  24.  
  25. if ($leader) {
  26. $this->solary = $this->solary + ($this->solary * 0.50);
  27. }
  28.  
  29. return $this->solary;
  30. }
  31.  
  32. }
  33.  
  34. class Engineer extends Employee {
  35. public $solary = 500;
  36. }
  37.  
  38.  
  39. $engineer = new Engineer(2);
  40.  
  41. ...
  42.  
Runtime error #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Properties cannot be declared abstract in /home/g9R2fN/prog.php on line 4