I have usually implemented Singletons as described in the Design Patterns book. Recently someone suggested another implementation of Singleton using creating a static instance of a class and returning that instead of using new and returning a pointer to the new singleton. I would like to get your input. Is there any advantages of using one or the other? Disadvantages? Disadvantages for the static singleton implementation?
Let me illustrate:
Traditional Singleton Implementation
Instance = new Car();
InstanceFlag = true;
Advantages & Disadvantages? Any documents or articles I can refer to for the second implementation ? Thanks for your help!
static Car theCar;