A user-defined copy constructor is generally needed when an object owns pointers or non-shareable references , such as to a file, in which case a destructor and an assignment operator should also be written (see Rule of three).
A user-defined copy constructor is generally needed when an object owns pointers or non-shareable references , such as to a file, in which case a destructor and an assignment operator should also be written (see Rule of three).