1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php class Foo { protected function bar() { echo __METHOD__ . "\n"; } } class Baz extends Foo { function qux() { $this->bar(); // Baz extends Foo, so it inherits bar(), but it is not overriding it parent::bar(); } } $baz = new Baz(); $baz->qux();
1 2
Foo::bar Foo::bar