Click here to Skip to main content
15,913,758 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: IXMLDOMDocument::loadXml question [modified] Pin
_anil_29-May-06 14:21
_anil_29-May-06 14:21 
GeneralRe: IXMLDOMDocument::loadXml question [modified] Pin
YaronNir29-May-06 20:02
YaronNir29-May-06 20:02 
GeneralRe: IXMLDOMDocument::loadXml question [modified] Pin
_anil_29-May-06 20:07
_anil_29-May-06 20:07 
GeneralRe: IXMLDOMDocument::loadXml question [modified] Pin
YaronNir29-May-06 20:26
YaronNir29-May-06 20:26 
GeneralRe: IXMLDOMDocument::loadXml question [modified] Pin
_anil_29-May-06 20:48
_anil_29-May-06 20:48 
GeneralRe: IXMLDOMDocument::loadXml question Pin
ThatsAlok30-May-06 1:35
ThatsAlok30-May-06 1:35 
AnswerRe: IXMLDOMDocument::loadXml question Pin
bob1697229-May-06 16:03
bob1697229-May-06 16:03 
GeneralRe: IXMLDOMDocument::loadXml question Pin
YaronNir29-May-06 20:01
YaronNir29-May-06 20:01 
QuestionWriting null character to a file Pin
fourierman29-May-06 10:48
fourierman29-May-06 10:48 
AnswerRe: Writing null character to a file Pin
Michael Dunn29-May-06 11:05
sitebuilderMichael Dunn29-May-06 11:05 
AnswerRe: Writing null character to a file Pin
bob1697229-May-06 14:03
bob1697229-May-06 14:03 
Question[Message Deleted] Pin
Rudy10229-May-06 9:22
Rudy10229-May-06 9:22 
AnswerRe: Save C++ Object to XML / Load XML data to C++ Pin
Maximilien29-May-06 10:15
Maximilien29-May-06 10:15 
AnswerRe: Save C++ Object to XML / Load XML data to C++ Pin
Eytukan29-May-06 15:52
Eytukan29-May-06 15:52 
GeneralRe: Save C++ Object to XML / Load XML data to C++ [modified] Pin
Rudy10229-May-06 19:45
Rudy10229-May-06 19:45 
GeneralRe: Save C++ Object to XML / Load XML data to C++ [modified] Pin
toxcct29-May-06 22:01
toxcct29-May-06 22:01 
GeneralRe: Save C++ Object to XML / Load XML data to C++ [modified] Pin
Rudy10230-May-06 3:45
Rudy10230-May-06 3:45 
QuestionMapi library error Pin
Javielgrande29-May-06 9:14
Javielgrande29-May-06 9:14 
QuestionSingletone Design Pattern Pin
knoxplusplus29-May-06 7:54
knoxplusplus29-May-06 7:54 
AnswerRe: Singletone Design Pattern Pin
Cedric Moonen29-May-06 8:16
Cedric Moonen29-May-06 8:16 
AnswerRe: Singletone Design Pattern Pin
G Haranadh29-May-06 18:15
G Haranadh29-May-06 18:15 
GeneralRe: Singletone Design Pattern Pin
BadKarma29-May-06 20:32
BadKarma29-May-06 20:32 
Hi,

this class isn't really a singleton, because you can make more than one instances of it.
You need to change the modifier of the constructor from public to at least protected.
This way one is forced to use the instance function.
class my_singleton
{
private:
 std::string my_string;
 my_singleton() : my_string("foo bar bash") {}

public:
 static my_singleton &instance()
 {
  static my_singleton global_instance;
  return global_instance;
 }
 
 std::string get_string() { return my_string; }
};
...
cout << my_singleton::instance().get_string() << endl;




codito ergo sum
GeneralRe: Singletone Design Pattern Pin
G Haranadh29-May-06 22:47
G Haranadh29-May-06 22:47 
GeneralRe: Singletone Design Pattern Pin
knoxplusplus30-May-06 7:36
knoxplusplus30-May-06 7:36 
GeneralRe: Singletone Design Pattern Pin
G Haranadh30-May-06 7:45
G Haranadh30-May-06 7:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.