grai Posted May 28, 2012 Report Share Posted May 28, 2012 If I have the following: class1 extends class0 class2 extends class1 How do I call from class2 a method in class0 which has been over-ridden by class1 without calling the class1's method? Want I want to do is super.super.method(); Thanks. Quote Link to comment Share on other sites More sharing options...
dave_59 Posted May 29, 2012 Report Share Posted May 29, 2012 You should have a very good and well documented reason for doing this. The syntax is class0::method().. Quote Link to comment Share on other sites More sharing options...
uwes Posted May 29, 2012 Report Share Posted May 29, 2012 hi, isnt the classtype::method() only valid for static members? Quote Link to comment Share on other sites More sharing options...
dave_59 Posted May 29, 2012 Report Share Posted May 29, 2012 No, it's just that the classtype::method syntax is usually the only way to access the identifier of a static method. Quote Link to comment Share on other sites More sharing options...
grai Posted May 30, 2012 Author Report Share Posted May 30, 2012 Thanks Dave. I think I'm using this in a safe way as it's for my connect_phase(). I want to change some of the connections the parent makes without effecting the grandparent connections. I think this should be a good enough reason?? :-) Quote Link to comment Share on other sites More sharing options...
dave_59 Posted May 30, 2012 Report Share Posted May 30, 2012 That's fine as long as it documented. If you start doing this too often, consider using configuration settings or making a sibling class as this jumping around will become hard to follow through many layers of inheritance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.