Example code 1:
<?php class People { private function status() {return __METHOD__;} public function Sleep(){ echo $this->status().'<br />'; } } class Programmer extends People { private function status() {return __METHOD__;} } $obj = new Programmer(); $obj->Sleep(); ?> Printed:People::status
Example code 2:
<?php class People { protected function status() {return __METHOD__;} public function Sleep(){ echo $this->status().'<br />'; } } class Programmer extends People { protected function status() {return __METHOD__;} } $obj = new Programmer(); $obj->Sleep(); ?> Printed:Programmer::status
All different in modifier methods private and protected.
Why in first case i get People::status? Why i did not get Programmer::status.
Explain me please, i don't understand this moment.
Peopledon't have access toProgrammerprivate methods.sleep()in Programmer classstatus()