1.

If dynamic_cast fails, which value is returned?(a) void(b) null(c) void pointer(d) null pointerI had been asked this question in an internship interview.This key question is from Downcasting in division Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Right answer is (d) null pointer

Easy EXPLANATION - The null pointer is RETURNED by the dynamic_cast, if it fails. The conversion sometimes fails because of too complex type conversion. The conversion MAY also fail DUE to memory or some RELATED issues.



Discussion

No Comment Found

Related InterviewSolutions