以下のコードをご覧ください。
<?php
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
?>
上記の例ではof$myFoo->test();
と呼んでいましたが、なぜofクラス
と呼んでいるのでしょうか。testPrivate
Bar class
testPublic
Foo
誰でもこれで私を助けることができますか?