I came across a question about design patterns.
He asked the apt template template to be used in a script where exactly two instances of the class had ever been created. I was not sure of the answer, but later described that Singleton can be used for such a scenario. He said that Singleton can guarantee that either only one instance of a class is created, or a fixed number (except one).
I always read the Singleton template as a template in which you can only create one class object, and thus the explanation surprised me. I am not sure I agree with this.
Any thoughts?
Aditya
source
share