Arjun Srivastava wrote:
Parent class reference variable p would be pointing to an object of Child class in the Heap Memory.
Arjun Srivastava wrote:
Kalyan Naveenan wrote:i have a Y class inherited from a X class. So how would Y my = new X(); instantiate?
Hope this helps you!
Kalyan Naveenan wrote:The second would be on a basic one. What would happen if the object instantiated is to a new class. For eg say "Object1 a = new Object2();". In this case, to which obect would a point to ?
Object1 a = new Object2(); you can't do this unless Object1 and Object2 has relationship; more over Object1 must be a super type of Object2
Iliyan Ivanov wrote:Can you please explain to me in short what tha Garbage Collector does and why is it useful ?
Thank you