Need a quick clarification, can a super class hold a reference to its child class like its going to have Is A and Has A relations. Example below
I saw simillar code in java.util.Calender, Its returning a GregorianCalender a sub class of Calender.
posted 3 months ago
Moving you to somewhere where you will get more attention.
Have you tried it? Can you think of any reason why such code would go wrong? Is there going to be any different between a subclass and any other class in terms of type for a field?
Have you been taught to say parent and child; those terms don't adequately represent inheritance in the computer sense of the world. It is better to say superclass and subclass (or maybe what they say in C#: base and derived classes).