a superclass reference variable can refer to a subclass object , but what is it's practical use?
Checked many websites ,stackoverflow ,books but I can't really understand this concept. â1.we can simply use a subclass reference for using a subclass object.so why use base class reference? â2.well every tutorial/book etc says runtime polymorphism is powerful feature but how? why do we even need it? it's "slower" than compile time polymorphism. I haven't found any source that "really" explains why they call it "powerful". One more thing that is often told "flexibility". what does it even mean in this context? â3.what really makes it unable to happen at compile time ? why methods of subclass called upon base class reference can't be resolved at compile time? All these questions arise because of this : " a superclass reference variable can refer to a subclass object ". Only use I know is that both super and sub class objects can be stored in an array of type super class. That's all. Where have you used elsewhere? ~ swim ~ , John Wells , David Carroll , Shadow đ