1.

If an object is passed by value, _________________(a) Temporary object is used in the function(b) Local object in the function is used(c) Only the data member values are used(d) The values are accessible from the original objectThis question was addressed to me in an online quiz.My doubt stems from Passing Object to Functions in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

Right choice is (b) Local OBJECT in the function is used

The explanation: When an object is called by values, copy CONSTRUCTOR is called and object is copied to the local object of the function which is mentioned in the argument list. The values GETS copied and are used from the local object. There is no need to access the original object again.



Discussion

No Comment Found

Related InterviewSolutions