diff --git a/singleton/Singleton.cpp b/singleton/Singleton.cpp index 6950c9d..5c66804 100644 --- a/singleton/Singleton.cpp +++ b/singleton/Singleton.cpp @@ -18,6 +18,15 @@ class Singleton { public: + // The copy constructor and assignment operator + // are defined as deleted, which means that you + // can't make a copy of singleton. + // + // Note: you can achieve the same effect by declaring + // the constructor and the operator as private + Singleton( Singleton const& ) = delete; + Singleton& operator=( Singleton const& ) = delete; + static Singleton* get() { if ( !instance )