Inspired by this question.
Usually the reason to make copy-constructor and assignment operator private
is to make the class non-copyable so that objects can only be created and destroyed, but not copied - most of the times it is because copying them would make no sense. In such cases the copy constructor and the assignment operator are both made private
and not implemented - if the class is not copyable then noone should copy.
Is there a case when copy constructor and assignment operator need to be private
and have meaningful implementation at the same time?