php - Method overiding and inheritance -


the code below:

class {     public function foo() {} }  class b extends {     private function foo() {} } 

gets me error :"access level b::foo() must public (as in class a)"

why can't override class foo method in class b private?

rules of access specifiers in method overriding

the rule says:

"the subclass overridden method cannot have weaker access super class method".


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -