1.

When are the object type known for upcasting the objects?(a) Compile time(b) Runtime(c) Source code build time(d) Doesn’t apply to objects directlyI got this question in exam.This intriguing question originated from Upcasting topic in division Default Arguments vs Overloading, Upcasting and Downcasting of Object Oriented Programming

Answer» RIGHT option is (b) Runtime

Best explanation: The upcasting with objects directly requires runtime resolving. The objects are fixed and address are ALLOCATED at compile time. But the execution of a program requires runtime knowledge of object TYPES, for implicit type CAST.


Discussion

No Comment Found

Related InterviewSolutions