1.

Which is correct syntax for declaring pointer to object?(a) className* objectName;(b) className objectName;(c) *className objectName;(d) className objectName();I had been asked this question in an internship interview.I'm obligated to ask this question of Pointer to Objects in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Correct option is (a) className* objectName;

The best I can explain: The syntax MUST contain * SYMBOL after the className as the type of object. This DECLARES an object POINTER. This can store address of any object of the specified CLASS.



Discussion

No Comment Found

Related InterviewSolutions