On 12/17/11 6:34 AM, so wrote:
If you are using singleton in your C++/D (or any other M-P language)
code, do yourself a favor and trash that book you learned it from.
---
class A {
static A make();
}
class B;
B makeB();
---
What A.make can do makeB can not? (Other than creating objects of two
different types :P )
Singleton has two benefits. One, you can't accidentally create more than
one instance. The second, which is often overlooked, is that you still
benefit of polymorphism (as opposed to making its state global).
Andrei