fix Singleton pattern

This commit is contained in:
Jakub Vojvoda
2016-10-05 09:59:15 +02:00
parent 931fdb52ab
commit f08970079d

View File

@@ -28,19 +28,19 @@ public:
std::cout << "This is Singleton." << std::endl; std::cout << "This is Singleton." << std::endl;
// ... // ...
} }
// ... // ...
private: private:
Singleton() {}
static Singleton *instance; static Singleton *instance;
// ... // ...
}; };
Singleton* Singleton::instance = nullptr;
int main() int main()
{ {
Singleton singleton; Singleton::get()->tell();
singleton.tell();
return 0; return 0;
} }