1.

What is downcasting?(a) Casting subtype to supertype(b) Casting supertype to subtype(c) Casting subtype to supertype and vice versa(d) Casting anytype to any other typeI got this question in exam.My query is from Downcasting in chapter Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Right OPTION is (b) Casting supertype to subtype

Explanation: The downcasting concept INCLUDES only the casting of supertypes to the sub types. This casting is generally done EXPLICITLY. Larger SIZE types are made to fit into SMALL size types explicitly.



Discussion

No Comment Found

Related InterviewSolutions