net*_*iul 4 php overriding private
我有一个包含函数funcB()的父类,我想通过在这个函数中进行一些更改来覆盖更好的函数.父类中的此函数调用同一类中的另一个私有函数.
示例代码:
class classA {
private function funcA() {
return "funcA called";
}
public function funcB() {
$result = $this->funcA();
return $result;
}
}
class ClassB extends ClassA {
public function funcB($a) {
//do some more stuff
$result = $this->funcA();
return $result;
}
}
Run Code Online (Sandbox Code Playgroud)
我得到致命错误,因为我不允许从ClassB内调用私有父:: funcA()函数.但必须要求召集.这怎么可能呢?