Click here to Skip to main content
15,891,943 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to pass text file data from MFC line Graph? Pin
Cedric Moonen16-Dec-10 1:00
Cedric Moonen16-Dec-10 1:00 
QuestionHow to save TransParent IMage after drawing on another image? Pin
002comp15-Dec-10 19:55
002comp15-Dec-10 19:55 
AnswerRe: How to save TransParent IMage after drawing on another image? Pin
Rozis16-Dec-10 11:59
Rozis16-Dec-10 11:59 
GeneralRe: How to save TransParent IMage after drawing on another image? Pin
002comp16-Dec-10 18:15
002comp16-Dec-10 18:15 
QuestionSingleton Class Pin
pix_programmer15-Dec-10 18:00
pix_programmer15-Dec-10 18:00 
AnswerRe: Singleton Class Pin
RaviRanjanKr15-Dec-10 19:08
professionalRaviRanjanKr15-Dec-10 19:08 
AnswerRe: Singleton Class Pin
Cedric Moonen15-Dec-10 20:23
Cedric Moonen15-Dec-10 20:23 
AnswerRe: Singleton Class PinPopular
Stefan_Lang15-Dec-10 22:41
Stefan_Lang15-Dec-10 22:41 
As others have pointed out, the idea is that the implementation of a singleton class has full control over the property of ever having only one instance. So you need to make sure that there is no way to create a second instance, if one is already in existance, meaning:

1. You can not create an instance with a constructor without going through the class's code
2. You can not copy an (i. e. the only existing) instance to make another one
3. You can access the one existing instance or create it from anywhere

The first is achieved by not providing a constructor that is public. The problem however is, that the C/C++ compiler implicitely always creates a default constructor if there is no other, and that default constructor would be dclared as public! Therefore we mus explicitely declare a default constructor that is private to prevent the compiler from creating a public one.

The second would be achieved by not creating a copy constructor, but again, the compiler implicitely creates one if there is no other. The safest way to prevent this is again, to explicitely define a private copy constructor.

The third can be achieved by defining a static function that delivers a reference or pointer to the one instance in existance. This function can check whether there already is an instance and retrun that, or if there is none, use the private constructor to create it.
GeneralRe: Singleton Class Pin
Sauro Viti15-Dec-10 23:24
professionalSauro Viti15-Dec-10 23:24 
QuestionCSV Pin
MsmVc15-Dec-10 17:33
MsmVc15-Dec-10 17:33 
AnswerRe: CSV Pin
Alain Rist15-Dec-10 20:11
Alain Rist15-Dec-10 20:11 
GeneralRe: CSV Pin
MsmVc15-Dec-10 20:19
MsmVc15-Dec-10 20:19 
QuestionRe: CSV Pin
Alain Rist15-Dec-10 20:34
Alain Rist15-Dec-10 20:34 
AnswerRe: CSV Pin
Cedric Moonen15-Dec-10 20:45
Cedric Moonen15-Dec-10 20:45 
GeneralRe: CSV Pin
Alain Rist15-Dec-10 20:51
Alain Rist15-Dec-10 20:51 
GeneralRe: CSV Pin
Cedric Moonen15-Dec-10 20:56
Cedric Moonen15-Dec-10 20:56 
AnswerRe: CSV Pin
Cedric Moonen15-Dec-10 20:28
Cedric Moonen15-Dec-10 20:28 
GeneralRe: CSV Pin
MsmVc15-Dec-10 20:44
MsmVc15-Dec-10 20:44 
QuestionSubclassing CHeaderCtrl in CListCtrl Pin
mesajflaviu15-Dec-10 8:54
mesajflaviu15-Dec-10 8:54 
AnswerRe: Subclassing CHeaderCtrl in CListCtrl Pin
Eugen Podsypalnikov15-Dec-10 9:09
Eugen Podsypalnikov15-Dec-10 9:09 
GeneralRe: Subclassing CHeaderCtrl in CListCtrl Pin
mesajflaviu16-Dec-10 21:07
mesajflaviu16-Dec-10 21:07 
GeneralRe: Subclassing CHeaderCtrl in CListCtrl Pin
Eugen Podsypalnikov17-Dec-10 0:37
Eugen Podsypalnikov17-Dec-10 0:37 
GeneralRe: Subclassing CHeaderCtrl in CListCtrl Pin
mesajflaviu19-Dec-10 20:40
mesajflaviu19-Dec-10 20:40 
AnswerRe: Subclassing CHeaderCtrl in CListCtrl Pin
Rolf Kristensen15-Dec-10 11:27
Rolf Kristensen15-Dec-10 11:27 
Question[SOLVED] Create ListView ActiveX using MFC Pin
martinergb15-Dec-10 6:47
martinergb15-Dec-10 6:47 

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.