A unique object represents a domain concept that must not be duplicated. Copying such an object violates its class invariant, even when the program compiles and runs normally. section 9.2
Avoid the duplication mistake by checking every copy operation:
- Hiding only the copy assignment operator is insufficient: the compiler can still provide a default copy constructor. section 9.2
A duplicated artwork
Constructing ArtPiece dup(ml) prints “Mona Lisa” twice: the compiler-created copy constructor silently produces a second object, with no visible forgery warning.
