1.

Why is downcasting possible in any language?(a) Because inheritance follows has-a relationship(b) Because inheritance follows is-a relationship(c) Because inheritance doesn’t follow any relationship(d) Because inheritance is not involved in castingI had been asked this question in homework.My doubt stems from Downcasting topic in section Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer»

Right option is (b) Because inheritance follows is-a relationship

For explanation: The downcasting is POSSIBLE because the CLASSES in inheritance follow is-a relationship. HENCE the DERIVED class is a base class. Which in turn make the downcasting possible.



Discussion

No Comment Found

Related InterviewSolutions