1.

Which among the following is true?(a) We can use direct assignment for any object(b) We can use direct assignment only for different class objects(c) We must not use direct assignment(d) We can use direct assignment to same class objectsThis question was posed to me during an internship interview.My doubt stems from Assigning Objects in portion Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming

Answer»

The correct choice is (d) We can use direct assignment to same class objects

For EXPLANATION: The direct assignment can be used with the same class objects. There is no RESTRICTION on them. But better if the program have a PREDEFINED COPY assignment OPERATOR.



Discussion

No Comment Found

Related InterviewSolutions