Hi, The following is asked me several times during the interview
Question : Can we have singleton with 2 instances or 3 instances or more ? How to achieve that ?
My Answer : It cannot be more than 1 instance.
But interviewers are never happy with my answer even though I gave them the Singleton code. Please let me know how to get it. Please post code which helps me a alot.
Personally I've always thought of the Singleton pattern as one that generally limits the amount of instances created, but not necessarily to a single instance. The name is misleading, but the general case makes more sense for a pattern.