Why should we provide our own copy constructor when default copy constructor is already provided by the compiler?

All QuestionsCategory: Cpp LanguageWhy should we provide our own copy constructor when default copy constructor is already provided by the compiler?
Chetan Shidling Staff asked 4 years ago

I need short information.

1 Answers
Chetan Shidling Staff answered 4 years ago

Normally, there is no need to write our own copy constructor when default copy constructor is already provided by the compiler itself. When the default copy constructor is called, exact copy of the original object is available due to bitwise copying. In such situations both the objects will share the same set of memory locations i.e., both of them point to the same place.