normally, (in subtype definition) I use
function enable() {
parent::enable();
}
function disable() {
parent::disable();
}
and then I call $subtypeinstance->enable()
but can I also use something like
$subtypeinstance->parent::enable()
or
(SupertypeName)$subtypeinstance->enable()
You can actually call
Parent::enable()
orparent::enable()
(i.e. class name orparent
keyword) as PHP makes no distinction between static and instance calls and passes an instance anyway.Output:
The parent keyword reference explains this and gives the same example.