0

I want limit object that can construct (2 more object) Singleton Pattern is similar this solution but only useful to only one object.

I need your help. HELP..

TheRed
  • 1
  • 1
  • 2
    And if you just create two objects? Is it really *necessary* to prevent more instances? – Christian Hackl Oct 30 '15 at 14:46
  • Note: the Singleton pattern is often considered an anti-pattern and you may want to rethink your design choices ([Why is Singleton considered an anti-pattern?](http://stackoverflow.com/questions/12755539/why-is-singleton-considered-an-anti-pattern)). – James Adkison Oct 30 '15 at 14:47
  • I just create some instances to defined number. Every other is same to singleton pattern. Should I be rethink solution? `static Singleton& getInstance(int i) { return inst[i]; }` Does this solution has any problem? – TheRed Oct 30 '15 at 15:06
  • What you're describing is known as Multiton pattern: https://en.wikipedia.org/wiki/Multiton_pattern – iluwatar Oct 31 '15 at 18:35

0 Answers0