Advertisement
Guest User

oop

a guest
Dec 6th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. interface iProgrammer
  4. {
  5. public function __construct($name, $salary); // задаем имя и зарплату
  6. public function getName(); // получить имя
  7. public function getSalary(); // получить зарплату
  8. public function getLangs(); // получить массив языков, которые знает программист
  9. public function addLang($lang); // добавить язык в массив языков
  10. }
  11. class Employee implements iProgrammer
  12. {
  13. private $name;
  14. private $salary;
  15.  
  16. public function __construct($name, $salary)
  17. {
  18. $this->name = $name;
  19. $this->salary = $salary;
  20. }
  21.  
  22. public function getName()
  23. {
  24. return $this->name;
  25. }
  26.  
  27. public function getSalary()
  28. {
  29. return $this->salary;
  30. }
  31. }
  32. class Programmer extends Employee implements iProgrammer
  33. {
  34. public function addLang($lang)
  35. {
  36. // реализация
  37. }
  38.  
  39. public function getLangs()
  40. {
  41. // реализация
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement