Datasim Financial Forums Forum Index


 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Singleton Pattern

 
Post new topic   Reply to topic    Datasim Financial Forums Forum Index -> Design Patterns
View previous topic :: View next topic  
Author Singleton Pattern
elektor



Joined: 06 Sep 2012
Posts: 1
Location: Berlin, Germany

PostPosted: Tue Sep 11, 2012 7:07 am    Post subject: Singleton Pattern Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Datasim Financial Forums Forum Index -> Design Patterns All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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