Passing by reference in copy constructor

Hi,
Can u pls elaborate on further that why are we passing object as reference in copy constructor.
And 2nd question is if it’s passed by reference so can we pass the object as pointer why and why not ?

hi @kartikey.rajput0071,
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…

(You would have infinite recursion because “to make a copy, you need to make a copy”.)

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.