Original Post
In the following: I am lost as to why they have not put implemntation for Instance() in a constructor Singleton(). Can you see a reason why they would avoid this? ~Wave
// Declaration
class Singleton {
public:
static Singleton* Instance();
protected:
Singleton();
private:
static Singleton* _instance;
}
// Implementation
Singleton* Singleton::_instance = 0;
Singleton* Singleton::Instance() {
if (_instance == 0) {
_instance = new Singleton;
}
return _instance;
}