Paste_Image.png
Paste_Image.png
<?php
abstract class ACanEat
{
abstract public function eat($food);
public function breath()
{
echo "Breath use the air." . "<br/>";
}
}
class Human extends ACanEat
{
public function eat($food)
{
echo "Human eating " . $food . "<br/>";
}
}
class Animal extends ACanEat
{
public function eat($food)
{
echo "Animal eating " . $food . "<br/>";
}
}
$man = new Human();
$man->eat('apple');//Human eating apple
$man->breath();//Breath use the air.
$monkey = new Animal();
$monkey->eat('banana');//Animal eating banana
$monkey->breath();//Breath use the air.
?>
Paste_Image.png