Upcasting and Downcasting
Upcasting
occurs when an object of one type is
assigned to a variable declared with a supertype
of the object.
No explicit casting is needed:
Polyhedron p = new Cube(5);
Downcasting
, however, requires an explicit cast:
Cube c = (Cube) p;