However, it is invoked implicitly when something is done that causes a COPY of an existing object to be created.
This happens when: Since the purpose of a copy constructor is to not only initialize the data in an object, but to initialize it as a copy of another existing object, the original object must be passed in as a parameter.
The explanations of the various constructs employed are given in the sections following.
I suspect what you meant to ask is: “When is it wise to explicitly define a copy and/or move assignment operator? The concise answer is: Whenever at least one of the following is true: Beware of claims that the answer depends on whether the class contains pointer members: That’s quite misleading.
If they both match the same, but are different functions, an ambiguity error results.
However for class types, identity assignment is not allowed.
This is sufficient for many cases, but not for ALL cases.
Example: This fraction object has a numerator of 3 and a denominator of 4.
I highly recommend the book “Elements of Programming” by Stepanov and Mc Jones.
Also look for presentations of Sean Parent on this topic.