} public function override() { parent::override(); echo "overridden!" . PHP_EOL; } } $foo = new Person("foo", 20); $bar = new Developer("bar", 30, "PHP"); $foo->introduce(); $bar->introduce(); $bar->knows(); $foo->override(); $foo->cannotOverride(); $bar->override(); $bar->cannotOverride(); // abstract class abstract class ANinja { public abstract function kill(Person $someone); protected abstract function isOk(); public function knowledge() { echo "this is a common method, already implemented!" . PHP_EOL; } } class Ninja extends ANinja { public function kill(Person $someone) { echo "killing {$someone->name}" . PHP_EOL;