1.

Which among the following is a mandatory condition for downcasting?(a) It must not be done explicitly(b) It must be done implicitly(c) It must be done explicitly(d) It can’t be done explicitlyThe question was asked in my homework.This intriguing question comes from Downcasting in section Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Right OPTION is (c) It must be DONE explicitly

Best EXPLANATION: The downcasting of any object must be done explicitly. This is because the compilers don’t support the implicit CONVERSION of a supertype to subtype.



Discussion

No Comment Found

Related InterviewSolutions