1.

Which is the correct syntax to call a member function using pointer?(a) pointer->function()(b) pointer.function()(c) pointer::function()(d) pointer:function()This question was posed to me during an interview.My question is from Pointer to Objects topic in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

The CORRECT OPTION is (a) POINTER->function()

Easy explanation - The pointer should be mentioned followed by the arrow OPERATOR. Arrow operator is APPLICABLE only with the pointers. Then the function name should be mentioned that is to be called.



Discussion

No Comment Found

Related InterviewSolutions