Polymorphism
A type t variable can contain any object whose type is t or a subtype of t
/* Because every Bathroom is a Room, both of the following statements are legal. */
Room r1 = new Room(); // LEGAL!
Room r2 = new Bathroom(); // LEGAL!
/* You can only access fields that are guaranteed to exist based on the type of the object reference. */
// System.out.println(r2.shower); NOT LEGAL!
/* Because not every Room is a Bathroom, only the second of the following statements is legal. */
// Bathroom r3 = new Room(); NOT LEGAL!
Bathroom r4 = new Bathroom(); // LEGAL!