Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Why do I need a copy constructor?
My basic question is what is the benefit I get by having a copy constructor? I mean from the optimization and efficiency point of view. Because ultimately insde the copy constructor you would be using the '=' assignment operator only so why not have only a overloaded '=' assignment operator instead of having a copy constructor.
In essence, why do I need a copy constructor? Can't I do with only an overloaded '=' operator?
0 · ·