时间:2021-07-01 10:21:17 帮助过:16人阅读
输出Bar::testPrivate呢?
class Bar
{
public function test() {
$this->testPrivate();
$this->testPublic();
}
public function testPublic() {
echo "Bar::testPublic\n";
}
private function testPrivate() {
echo "Bar::testPrivate\n";
}
}
class Foo extends Bar
{
public function testPublic() {
echo "Foo::testPublic\n";
}
private function testPrivate() {
echo "Foo::testPrivate\n";
}
}
$myFoo = new foo();
$myFoo->test(); // Bar::testPrivate
// Foo::testPublic
为啥第一行会
http://www.bkjia.com/PHPjc/326157.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/326157.htmlTechArticle 代码如下:class Bar { public function test() { $this-testPrivate(); $this-testPublic(); } public function testPublic() { echo "Bar::testPublic\n"; } private functi...