1.

Why temporary object is not created in return by reference?(a) Because compiler can’t create temporary objects(b) Because the temporary object is created within the function(c) Because return by reference just make the objects points to values memory location(d) Because return by reference just make the object point to nullThe question was asked in final exam.Asked question is from Returning Objects topic in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Right option is (c) Because RETURN by reference just MAKE the OBJECTS points to values memory location

To explain: A reference to the memory location where the returned object is stored is made. This allows the NEW object which TAKES the return value, point to the memory location and hence access the same values.



Discussion

No Comment Found

Related InterviewSolutions