<<< Disabling copy operations | Index | Disabling copy example >>> |
Solution:
Prevent copying by declaring copy constructor and assignment private.
However, the class itself could still access private class members!
Therefore,
declare them as member functions, but do not define them;
provide only function prototypes, but do not define the actual code.
In attempt to copy objects within the class,
the compile process succeeds, but
the linker will fail to find the code it needs, resulting in
unresolved external symbol error.
<<< Disabling copy operations | Index | Disabling copy example >>> |