I have two classes parent and child and child extends parent.
Parent parent = new Child();
Works as expected but the confusion happens when the object is in an container like so.
Vector<Parent> vp = new Vector<Child>();
This gives the error:
incompatible types: Vector<Child> cannot be converted to Vector<Parent>
So my question is does the container prevent the implicit typecasting that occurs when we do
parent = new Child();