1.

Which error will be produced if a local object is returned by reference outside a function?(a) Out of memory error(b) Run time error(c) Compile time error(d) No errorThis question was addressed to me in homework.This intriguing question originated from Returning Objects in division Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

The CORRECT answer is (C) Compile time ERROR

Best explanation: If the local object is RETURNED outside the function then the compile-time error arises. While the program is being converted and the processes happening during compile time, the COMPILER won’t be able to resolve the statement.



Discussion

No Comment Found

Related InterviewSolutions