1//Put this in the .cpp
2Singleton *Singleton::instance = NULL;
3
4//! This is the Singleton definition in .hpp
5class Singleton {
6private:
7 static Singleton *instance;
8
9public:
10 static Singleton *getInstance() {
11 if (instance == NULL) {instance = new Singleton; }
12 return instance;
13 }
14
15protected:
16 Singleton() { std::cout << "singleton created\n"; };
17};
18