I came across a question on Design Patterns.
It asked for the apt design pattern to use in a scenario where exactly two instances of a class are ever created. I was not sure of the answer but the description later said that the Singleton can be used for such a scenario. It said that the Singleton can ensure that either only one instance of a class or a fixed number (other than one) are created.
I have always read the Singleton pattern as a pattern where only one object of a class can be created and thus the explanation surprised me. I am not sure I agree with it.
Any thoughts?
Aditya