1.

What happens when downcasting is done but not explicitly defined in syntax?(a) Compile time error(b) Runtime error(c) Code write time error(d) Conversion errorI had been asked this question in an interview for job.Asked question is from Downcasting in chapter Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Correct choice is (a) Compile time error

The best explanation: The IMPLICIT DOWNCASTING is not possible. If tried, the COMPILER PRODUCES an error. Since the compiler doesn’t allow coasting to a type that is not compatible.



Discussion

No Comment Found

Related InterviewSolutions