An Example/Tutorial of the Singleton Design Pattern
A Singleton is a single instance of a class throughout the whole system. Usually used for a global class in a system that can be accessed by everyone. The life of a singleton class is the duration of the entire application. It typically has uses for things like Logs, Audio, Application Sysetms things that generally need only 1 instance in the entire application.
Singletons are created by a static member function that returns a pointer to the single instance of the class. Only this member function can call the constructor by making the constructor private and the copy constructor and = operator.
Add A Comment
You must be logged in to post a comment.