extrovertive Posted December 29, 2008 Share Posted December 29, 2008 I know a final method (i.e. final public function foo(){}) prevents a child class from overriding that method. But can a private method be override in a child class? If so, what's difference does it make between a protected method? What's the difference between making a method final and a method private? Examples? Link to comment https://forums.phpfreaks.com/topic/138708-simple-oop-concept-here-final-vs-private/ Share on other sites More sharing options...
Mchl Posted December 29, 2008 Share Posted December 29, 2008 private method can not be called from child classes, final can (as long as it is protected or public) In other words: public, protected, private - tell who can call the method final - tells that method can not be overriden Link to comment https://forums.phpfreaks.com/topic/138708-simple-oop-concept-here-final-vs-private/#findComment-725217 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.