• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

Calling grandfather class methods

Hi everyone,

I need to call a method for a class up in the hierarchy.  That has similar meaning to super.super.method1();

parent of the parent's method1

  • 2
1 Solution
You can't.
There's 3 ways of doing this:
1) just call the inherited method,
2) have the super class call   super.method() for you,
3) make it static so it is accessible by class name.
Tommy BraasCommented:
Hi The14follower,

Unless you're able to do the first of sciuriware's suggestion, I would contend that there is a problem in your class design. You might be better off fixing the class hierarchy, rather than trying to hack your specific need.

May be this question is raised because it's possible in C++ which is, for that matter, a very confusing feature:

     class C : B ....

     class B : A ....

in C:
          A::function() .....

The14followerAuthor Commented:
Thank you very much.  That will save my time trying to do nothing.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now