1.

Which symbol should be used to pass the object by reference in C++?(a) &(b) @(c) $(d) $ or &The question was posed to me in examination.The doubt is from Passing Object to Functions topic in chapter Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

The CORRECT option is (a) &

For explanation: The OBJECT to be passed by REFERENCE to the function should be preceded by & symbol in the argument list syntax of the function. This indicates the compiler not to use NEW object. The same object which is being passed have to be used.



Discussion

No Comment Found

Related InterviewSolutions