Copy Constructor

I don’t get it why we are using reference in overwritten copy constructor…
car( car &x){…}
^

@rupesh-4819
Because if it’s not by reference, it’s by value. To do that you make a copy, and to do that you call the copy constructor. But to do that, we need to make a new value, so we call the copy constructor, and so on…

┗|`O′|┛ i still don’t get it

@rupesh-4819
It is necessary to pass object as reference and not by value because if you pass it by value its copy is constructed using the copy constructor . This means the copy constructor would call itself to make copy . This process will go on until the compiler runs out of memory.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.