Singleton class model


/ Published in: C++
Save to your folder(s)

Note: This doesn't work in multi-threaded environments, check http://en.wikipedia.org/wiki/Singleton_pattern#C.2B.2B

Singleton class model
then:
SingletonClass *pSC = SingletonClass::get_singleton_instance();
pSC->any_public_function();
or: SingletonClass::get_singleton_instance()->any_public_function();

at the end of the program don't forget: SingletonClass::destroy();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.