Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Pets {
- public $name;
- public $body;
- public $head;
- public $tail;
- public $paws;
- public function __construct($name,$body,$head,$tail,$paws){
- $this->name = $name;
- $this->body = $body;
- $this->head = $head;
- $this->tail = $tail;
- $this->paws = $paws;
- }
- }
- class Dogs extends Pets{
- public $wool;
- public $ice;
- public $color;
- public function __construct($name,$body,$head,$tail,$paws,$wool,$ice,$color){
- parent::__construct($name,$body,$head,$tail,$paws);
- $this->wool = $wool;
- $this->ice = $ice;
- $this->color = $color;
- }
- public function show(){
- $string = $this->name;
- $string .= $this->body;
- $string .= $this->head;
- $string .= $this->tail;
- $string .= $this->paws;
- $string .= $this->wool;
- $string .= $this->ice;
- $string .= $this->color;
- return $string;
- }
- }
- $booldog = new Dogs('Бульдог','Короткое','Маленькая','Короткий','Коотенькие','Короткая','Голубые','Бежевый');
- echo $booldog->show('Название породы');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement