php - Method overiding and inheritance -
this question has answer here:
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
Post a Comment