Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing the base class methods in child class.

 
shan raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Below is the code snippet. I want to call the func1() of class A in class C. if I use super.func1(), the class B method will be called. But I want to call func1() of class A. Can any one tell me how to call the func1() in class C in proper way.

 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is already a discussion about that. Check Invoke Grand-Parent Method
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian Janisch wrote:There is already a discussion about that. . . .
Good idea to quote that discussion. I seem to remember that thread also says such coding would be bad design.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic