Category: <span>Framework Designing</span>

Singleton Design Pattern

Singleton Design Pattern WHAT? In some cases, it is important to have exactly one instance of a class. Although you have many electric appliance in your house but you have only one main switch box for incoming electricity in house. You have only one control panel in your windows Operating system. There is only one payroll software system to handle paychecks. How do you ensure that you have only one instance of a class and that is also easily accessible? A global variable makes an object accessible but it does not prevent you from instantiating multiple objects. A better solution …