What is singleton pattern?

What is singleton pattern?

Sometimes we need to have only one instance of our class for example a single DB connection. The singleton design pattern restricts the instantiation of a class to a single instance. This is done in order to provide coordinated access to a certain resource, throughout an entire software system.