Ejemplo n.º 1
0
    protected abstract function youNeedToProtectThisMan();
}
class ChildClass extends AbstractClass
{
    public function youNeedThisMan()
    {
        echo 'I got this bro!';
    }
    protected function youNeedToProtectThisMan()
    {
        echo 'I got this protected bro!';
    }
    public function printProp()
    {
        echo $this->someProp;
    }
}
$class = new ChildClass();
$class->youNeedThisMan();
echo '<br />';
$class->printProp();
$class->youNeedToProtectThisMan();
// Will error out
/*
Result:

I got this bro!
Hello!

Fatal error: Call to protected method ChildClass::youNeedToProtectThisMan()
*/