I have
class P {
function fun() {
echo "P";
}
}
class Ch {
function fun() {
echo "Ch";
}
}
$x = new Ch();
How to call parent function fun from $x? Is it possible to do it directly or I have to write:
function callParent {
parent::fun();
}
Simple… don’t have a method of the same name in the child, in which case the parent method will be inherited by the child, and a call to $x->fun() will call the inherited method.