1.

If an object is passed by address, will be constructor be called?(a) Yes, to allocate the memory(b) Yes, to initialize the members(c) No, values are copied(d) No, temporary object is createdThe question was posed to me in final exam.This question is from Passing and Returning Object with Functions in section Object of Object Oriented Programming

Answer»

The correct option is (c) No, values are copied

Best explanation: A copy of all the values is CREATED. If the constructor is called, there will be a compile time ERROR or memory shortage. This happens because each time a constructor is called, it TRY to call itself again and that goes infinite TIMES.



Discussion

No Comment Found

Related InterviewSolutions