1.

Pointer to a base class can be initialized with the address of derived class, because of _________(a) derived-to-base implicit conversion for pointers(b) base-to-derived implicit conversion for pointers(c) base-to-base implicit conversion for pointers(d) derived-to-derived implicit conversion for pointersI have been asked this question by my school teacher while I was bunking the class.I want to ask this question from Pointer to Objects topic in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Right answer is (a) derived-to-base IMPLICIT CONVERSION for pointers

The explanation is: It is an implicit rule defined in most of the programming languages. It PERMITS the programmer to DECLARE a pointer to the derived class from a base class pointer. In this way the programmer doesn’t have to declare object for derived class each TIME it is required.



Discussion

No Comment Found

Related InterviewSolutions