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...??

1st Jul 2017, 5:57 PM
Anshul Garg
Anshul Garg - avatar
3 odpowiedzi
+ 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.
1st Jul 2017, 6:26 PM
Rrestoring faith
Rrestoring faith - avatar
1st Jul 2017, 6:43 PM
Rrestoring faith
Rrestoring faith - avatar
0
Can you explain it with an example plz...
1st Jul 2017, 6:37 PM
Anshul Garg
Anshul Garg - avatar