The Singleton mode proposed in the DP cannot be used to be used as inheritance base classes, and each time you have to design a Singleton class in accordance with Singleton's rules, especially when Singleton appears frequently. Singleton in the MCD is also outsourcing, this is a Singleton is used as a base class, but it is related to the language, and it is no problem in C .
Here is the implementation of this template class:
template
Use very simple:
Class Machine: Public Singleton
CLIENT if this: Machine Obj;
Or: Machine * PMCH = New Machine;
Both Singlet will throw an exception period. Once some people have filed that they can identify these abnormalities in the compile period, I think there is no way, at least I have never thought of the way, of course, may have a better way to have a better way to pass by Please note.