0
Pointer for sub class in java
Hey can anyone answer what ref variable we use for calling members of sub class from present class... Super is for parent... This is for preset... Then what do we use for sub class...??
3 Answers
+ 3
You can override a method from the sub class then call the method from the super class. For variables it would just be a getter method.
Or
You could cast to an object of the sub class and then call the member.
If you need to constantly use subclass stuff from the super class then I'd say there's a problem in your design.
0
Can you explain it with an example plz...