CodeBase - Singleton Example

Return to the CodeBase listing

Category: Miscellaneous

Version: 1.0

0
0

Information

Uploaded: 5th Jul 2012 22:44

Modified: 5th Aug 2012 19:21

Author:  Dar13

Summary

This is an example of the singleton programming style in C++.

Full Description

This is a simple singleton-style class. It isn't as feature-rich or pretty as some other implementations(see Ogre3D's Ogre::Singleton<T> template class) but it gets the job done.<br /> <br /> To use, you just use the same format but add your own functions and variables to the class.<br /> <br /> For all those who don't know what a singleton is: a singleton is a special type of class that's constructed and managed in such a way as that there is only one instance of the class created at one time, basically the equivalent of a global variable though it has more uses than that.<br /> <br /> I'm attaching one of my in-use singleton classes that uses Ogre's Singleton template instead of this simplistic implementation.

Comments

No comments yet.