php 5.3 - php5 --- method visibility issue -
please have @ below given code.
<?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 ?>
in above example, when called $myfoo->test();
it called testprivate
of bar class
how come called testpublic
of foo
class.
can 1 me in ?
bar.testprivate
, foo.testprivate
have protected methods instead of private ones. see here more:
Comments
Post a Comment