/** * singleton.h * Implemented by Blueprint Technologies, Inc. */ #ifndef _singleton_h #define _singleton_h /** * Defines an Instance operation that lets clients access its * unique instance. Instance is a class operation (that is, * a class method in Smalltalk and a static member function * in C++). */ class Singleton { private: static Singleton* singleton; public: static Singleton* instance() { if( singleton == 0 ) { singleton = new Singleton(); } return singleton; }; }; Singleton* Singleton::singleton = 0; #endif