Vote count:
0
class A {
public $prop = 1;
function test(){
$this->prop++;
}
}
class B extends A {
function test(){
// No code only override;
}
}
How can I make sure that class B
will have a function test()
and calling it will increment prop
?
In this example function test
exists but prop
will not get incremented. How can I make sure that parent function will be called without having to manually put parent::test()
?
asked 44 secs ago
PHP Force execution of parent method
Aucun commentaire:
Enregistrer un commentaire