1.

What is upcasting?(a) Casting subtype to supertype(b) Casting super type to subtype(c) Casting subtype to super type and vice versa(d) Casting anytype to any other typeThis question was addressed to me by my college professor while I was bunking the class.This interesting question is from Upcasting topic in section Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Right option is (a) CASTING subtype to supertype

To explain I WOULD say: The UPCASTING concept INCLUDES only the casting of subtypes to the super types. This casting is GENERALLY done implicitly. Smaller size types can fit into larger size types implicitly.



Discussion

No Comment Found

Related InterviewSolutions