Upcasting

Treating an object as its parent type; always safe and automatic.

What is Upcasting?

Upcasting is treating an object as its parent type. It is always safe, because a Dog is an Animal. It happens automatically.

Dog rex = new Dog();
Animal pet = rex; // upcast

Level: Journeyman · More OOP terms at this level

Updated