1.

Which among the following is true for copy constructor?(a) The argument object is passed by reference(b) It can be defined with zero arguments(c) Used when an object is passed by value to a function(d) Used when a function returns an objectI have been asked this question in an online quiz.The origin of the question is Constructors topic in division Constructors and Destructors of Object Oriented Programming

Answer»

Right ANSWER is (B) It can be defined with zero arguments

Easiest explanation - It can’t be defined with zero number of arguments. This is because to copy ONE OBJECT to another, the object must be mentioned so that COMPILER can take values from that object.



Discussion

No Comment Found

Related InterviewSolutions