matthewhaworth Posted August 28, 2007 Share Posted August 28, 2007 If class 'user', inherits class 'guest', then can an instance of class 'user' reference class 'guest''s functions? I.e. class guest { function doSomething() { // does something } function doSomethingElse() { // does something else } } class user implements guest { function doEvenMore () { // does even more } } $user = new user; $user->doSomething(); Is that possible? Link to comment https://forums.phpfreaks.com/topic/67149-calling-parent-classes/ Share on other sites More sharing options...
matthewhaworth Posted August 29, 2007 Author Share Posted August 29, 2007 I've realised it is now . Though I have a new problem, what's the difference between 'implements' and 'extends'. Link to comment https://forums.phpfreaks.com/topic/67149-calling-parent-classes/#findComment-336789 Share on other sites More sharing options...
nloding Posted August 29, 2007 Share Posted August 29, 2007 What the words imply. If you are 'implementing' an interface, you are using it. If you are extending a parent, you are adding to it. Link to comment https://forums.phpfreaks.com/topic/67149-calling-parent-classes/#findComment-336821 Share on other sites More sharing options...
Daniel0 Posted September 1, 2007 Share Posted September 1, 2007 I've realised it is now . Though I have a new problem, what's the difference between 'implements' and 'extends'. If you use implements then you are using interfaces, but if you use extend then you are, well, extending the class, you are making your class a child of the class you are extending (which will be the parent class). Note that you can implement multiple interfaces but you can only extend one class. Link to comment https://forums.phpfreaks.com/topic/67149-calling-parent-classes/#findComment-339262 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.