In order to make an object non-copiable we can explicitly delete both its copy-constructor and copy-assignment operator.
My question is: What is the right place to
delete
works just as well with private
access.
The effect of delete
is to cause an error if the function is chosen by overload resolution.
The effect of private
is to cause an error if the function is chosen by overload resolution from outside the class or its friends.
If both errors apply, the ultimate outcome is the same either way, but public
might help avoid compiler messages about access privileges, which could cause confusion.