1.

Which among the following is true?(a) Upcasting is possible only for single level inheritance(b) Upcasting is possible only for multilevel inheritance(c) Upcasting is possible only for multiple inheritance(d) Upcasting is possible for any type of inheritanceI had been asked this question in my homework.The query is from Upcasting topic in section Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

The correct option is (d) UPCASTING is possible for any TYPE of inheritance

The EXPLANATION: The type of inheritance doesn’t matter with the upcasting CONCEPT. Upcasting APPLIES to all types of inheritance. Any derived class object can be upcasted to any of its base class object.



Discussion

No Comment Found

Related InterviewSolutions