Copy constructor definition requires __________________
A. Object to be passed by value
B. Object not to be passed to it
C. Object to be passed by reference
D. Object to be passed with each data member value
This question was addressed to me in exam.
I want to ask this question from Passing Object to Functions in section Assigning Object, Pointer to Objects, Passing and Returning Object of Object Oriented Programming
Correct option is C. Object to be passed by reference
Easy explanation – The object must be passed by reference to a copy constructor. This is to avoid the out of memory error. The constructors keeps calling itself, if not passed by reference, and goes out of memory.