A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Refactoring for Software Design Smells: Managing Technical Debt
this week in the
OO, Patterns, UML and Refactoring
superclass use a method of its subclass?
Joined: Apr 14, 2013
Apr 17, 2013 09:39:11
Can a Superclass use a method of its subclass if yes how.....?
Joined: Nov 09, 2012
Apr 17, 2013 09:42:16
Inheritance, its fairly straightforward what the answer is though
Joined: Oct 02, 2003
Apr 17, 2013 09:57:36
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.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Have you checked out
subject: superclass use a method of its subclass?
how can we access a method from sub class from its super class?
Doubt in assigning super class and subclass variables
Why we got warning when calling a static method through an instance?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015