I understand that the Singleto pattern is used to create only one instance of an object.
In the Greenbook\Patterns\Singleton code. I can create two instances of the AnyOldThing class
- Code: Select all
AnyOldThing* pp = Singleton<AnyOldThing>::instance();
cout << pp -> coeff() << endl;
AnyOldThing *hp = Singleton<AnyOldThing>::instance();
cout << hp -> coeff() << endl;
Isn't that countering the meaning of the singleton?
Regards
Neville