interface Animal {
public function Say();
}
class Dog implements Animal {
public function Say()
{
echo '(Dog) Woof! Woof!';
}
}
class Cat implements Animal {
public function CatSay() // Error
{
echo '(Cat) Meow! Meow!';
}
}
$dog = new Dog();
$dog->Say();
/*
run:
Fatal error: Class Cat contains 1 abstract method and must therefore be
declared abstract or implement the remaining methods (Animal::Say)
in C:\xampp\htdocs\allonpage.com\test.php on line 22
*/