This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

superclass use a method of its subclass?  RSS feed

 
sandy chauhan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can a Superclass use a method of its subclass if yes how.....?
 
Stuie Clarky
Ranch Hand
Posts: 98
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read about Java Inheritance, its fairly straightforward what the answer is though
 
fred rosenberger
lowercase baba
Bartender
Posts: 12440
42
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would a superclass know which sub-class method to use? Or if there even is a sub-class?

I am assuming you are talking about creating an instance of the superclass, not simply using a super-class reference variable that it pointing to a subclass instance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!