I am confused when I read this (regarding singleton design pattern):
How do we ensure that a class has only one instance and that the instance is easily accessible? A global variable makes an object accessible, but it doesn't keep you from instantiating multiple objects.
So what is the use of singleton pattern if we can create multiple instances?
SOURCE:
Design Patterns - Elements Of Reusable Object Oriented Software (1995) - Gamma, Helm, Johnson, Vl