> Design Patterns > Singleton Design Pattern
Singleton design pattern is used to create one and only one instance of a class.
The intent is to have only one instance of a class and it should be accessible to multiple clients through well-defined access point.
There are scenarios where one and only one instance of class is required, for example File System, System Manager etc and it has to be accessed from multiple applications. Introducing of global variable provides access to multiple applications but does not make sure that there will be only one instance.
The class itself can take the responsibility of creation of not more than one instance and can provide the well-defined access point for multiple applications.
|C++||Singleton Pattern in C++||Singleton Pattern C++ Example|
|C#||Singleton Pattern in C#||Singleton Pattern C# Example|
|Java||Singleton Pattern in Java||Singleton Pattern Java Example|
|Python||Singleton Pattern in Python||Singleton Pattern Python Example|
|PHP||Singleton Pattern in PHP||Singleton Pattern PHP Example|
|Ruby||Singleton Pattern in Ruby||Singleton Pattern Ruby Example|
|Swift||Singleton Pattern in Swift||Singleton Pattern Swift Example|
|Objective-C||Singleton Pattern in Objective-C||Singleton Pattern Objective-C Example|