1.

Downcasting is _______________________(a) Always safe(b) Never safe(c) Safe sometimes(d) Safe, depending on codeI had been asked this question during an interview.This question is from Downcasting in section Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Right choice is (b) Never safe

For explanation: The downcasting concept is made for exception cases. When there is a NEED to represent an entity in the FORM which is not suitable for it. Representing a base TYPE in DERIVED type is not right but can be done for special cases.



Discussion

No Comment Found

Related InterviewSolutions