The NonCopyable class prevents objects of a class from supporting copy operations. You can easily identify it from its class declaration. It creates a compile-time error if you copy the object. Inheriting from this class results in autogeneration of private copy construction and copy assignment operations, which are not accessible in derived classes.
We recommend using the NonCopyable class whenever a class owns a resource (lock/hardware/file) that should not be copied to another class.
NonCopyable class reference
|Protected Member Functions|
|NonCopyable (const NonCopyable &)|
|NonCopyable &||operator= (const NonCopyable &)|