name = $name; $this->age = $age; $this->gender = $gen; } function getGeneralInfo() { echo "$this->name , has age: $this->age"; } function getGender(){ echo "$this->gender"; } public function addAge(){ $this->age++; } } class Cat extends Pets { public $breed; function __construct($name, $age, $gen, $breed) { parent::__construct($name, $age, $gen); $this->breed = $breed; } function getGeneralInfo() { echo "Cat named $this->name has age: $this->age"; } function getInfoAboutAge() { $age = $this->age; if($age < 1.5) echo "It's kitty"; else if ($age >= 1.5 and $age < 3) echo "It's yang cat"; else if ($age >= 3 and $age < 7) echo "It's middle-aged cat"; else echo "It's old cat"; echo ""; } public function mew(){ echo "$this->name is mew"; } } class Dog extends Pets { public $breed; function __construct($name, $age, $gen, $breed) { parent::__construct($name, $age, $gen); $this->breed = $breed; } function getGeneralInfo() { echo "Dog named $this->name (breed - $this->breed) has age: $this->age"; } public function bark(){ echo "$this->name is barking"; } } class Hamster extends Pets { public $genus; function __construct($name, $age, $gen, $genus) { parent::__construct($name, $age, $gen); $this->genus = $genus; } function getGenus() { echo "$this->genus"; } public function bark(){ echo "$this->name is barking"; } } $dog1 = new Dog('Дружок', 7, 'M', 'хаски'); $dog1->getGeneralInfo(); $dog1->bark(); $cat = new Cat('Мурзик', 6, 'M', 'сиамец'); $cat->getGeneralInfo(); $cat->getInfoAboutAge(); $cat->addAge(); $cat->getInfoAboutAge(); $dog1 ->getGeneralInfo(); $cat2 = new Cat('Барсик', 3, 'M', 'британец'); $cat2->mew(); //Hamster ?> Results: Dog named Дружок (breed - хаски) has age: 7Дружок is barkingCat named Мурзик has age: 6It's middle-aged catIt's old catDog named Дружок (breed - хаски) has age: 7Барсик is mew