1.

If pointer to an object is declared __________(a) It can store any type of address(b) It can store only void addresses(c) It can only store address of integer type(d) It can only store object address of class type specifiedI have been asked this question in an interview for internship.The query is from Pointer to Objects topic in portion Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Right option is (d) It can only store object address of class type specified

Explanation: The address of only the specified class type can get their address STORED in the object pointer. The addresses doesn’t DIFFER but they do differ for the AMOUNT and type of memory required for objects of different classes. HENCE same class object pointer should be used.



Discussion

No Comment Found

Related InterviewSolutions