复制代码 代码如下:
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
新闻热点
疑难解答