View previous topic :: View next topic |
Author |
Singleton Pattern |
elektor
Joined: 06 Sep 2012
Posts: 1
Location: Berlin, Germany
|
Posted: Tue Sep 11, 2012 7:07 am Post subject: Singleton Pattern |
|
|
Hi Daniel,
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: |
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
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|