• Post Reply Bookmark Topic Watch Topic
  • New Topic

calling overridden superclass method  RSS feed

 
meenakshi ashokkumar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i have a class A with display method,
class B extends A with display method &
class C extends B with display method,
how can i call the display meethod in class A thro' a reference variable that refers to a C object?
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, you can't directly.
but the following code would work,

The issue here is, we can't directly call c.super.super.display() you know...so we have to go via delegation model...
Regards
Maulin
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!