I do not know how to write a heading in this case, but what is the actual question?
See the code:
<?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(); ?> At the exit, the following People::status
In this example, we change access modifiers to protected (or the public result will be the same as that of protected )
<?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(); ?> The output is the following Programmer::status
How does this mechanism work? It is not clear why with private he does not give the same result as with protected . I didn’t see anything like this on php.net (there is something briefly mentioned about closed methods, but this information is not enough to understand)