Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <?php
  2.  
  3. class Pets {
  4.  
  5. public $name;
  6. public $body;
  7. public $head;
  8. public $tail;
  9. public $paws;
  10.  
  11. public function __construct($name,$body,$head,$tail,$paws){
  12. $this->name = $name;
  13. $this->body = $body;
  14. $this->head = $head;
  15. $this->tail = $tail;
  16. $this->paws = $paws;
  17. }
  18.  
  19. }
  20.  
  21. class Dogs extends Pets{
  22.  
  23. public $wool;
  24. public $ice;
  25. public $color;
  26.  
  27. public function __construct($name,$body,$head,$tail,$paws,$wool,$ice,$color){
  28. parent::__construct($name,$body,$head,$tail,$paws);
  29. $this->wool = $wool;
  30. $this->ice = $ice;
  31. $this->color = $color;
  32. }
  33.  
  34. public function show(){
  35.  
  36. $string = $this->name;
  37. $string .= $this->body;
  38. $string .= $this->head;
  39. $string .= $this->tail;
  40. $string .= $this->paws;
  41. $string .= $this->wool;
  42. $string .= $this->ice;
  43. $string .= $this->color;
  44.  
  45. return $string;
  46.  
  47. }
  48.  
  49. }
  50.  
  51. $booldog = new Dogs('Бульдог','Короткое','Маленькая','Короткий','Коотенькие','Короткая','Голубые','Бежевый');
  52.  
  53. echo $booldog->show('Название породы');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement