If you inherit from an abstract class, any method in the abstract class marked as abstract *must* be implemented by the extending class. For example, in the following abstract class:
<?php
abstract class AbstractClass
{
public function setup() {}
abstract public function doSomething();
}
?>
the method 'doSomething' must be defined in the extending class. Thus, the following does *not* work:
<?php
class ConcreteClass extends AbstractClass
{
public function doMyOwnThing() {}
}
?>
But the following *will*:
<?php
class ConcreteClass extends AbstractClass
{
public function doMyOwnThing() {}
public function doSomething() {}
}
?>
The lesson to learn here: if the method is truly optional to the implementation, either do not define it in the abstract class at all, or do not tag it as abstract.