Click here to Skip to main content
15,899,124 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGetWindowText [modified] Pin
Sam 200624-May-06 15:13
Sam 200624-May-06 15:13 
AnswerRe: GetWindowText [modified] Pin
_anil_24-May-06 15:48
_anil_24-May-06 15:48 
GeneralRe: GetWindowText [modified] Pin
Sam 200624-May-06 16:09
Sam 200624-May-06 16:09 
GeneralRe: GetWindowText [modified] Pin
_anil_24-May-06 16:26
_anil_24-May-06 16:26 
GeneralRe: GetWindowText [modified] Pin
Sam 200624-May-06 17:29
Sam 200624-May-06 17:29 
GeneralRe: GetWindowText [modified] Pin
Nibu babu thomas24-May-06 17:58
Nibu babu thomas24-May-06 17:58 
GeneralRe: GetWindowText [modified] Pin
Sam 200625-May-06 9:12
Sam 200625-May-06 9:12 
QuestionDefinitive singleton implementation Pin
Louis Clayton24-May-06 12:17
Louis Clayton24-May-06 12:17 
OK, I have recently been looking into putting and end to my singleton woes once and for all by creating a singleton base class from which any class that needs to be a singleon can simply inherit and hey presto its a singleton.

Now I refer you to the article http://www.codeproject.com/cpp/singleton.asp (probably the best article I have seen on the matter).

Having seen another implementation that makes use of creation policies I have decided that this is the way to go and provides the greatest flexibility while still being a single class. However, from my experimemts with this design I have noticed that in order for derived classes to be true singletons, their constructors must be declared private (or rather not public) otherwise an instance of the derived class may be declared. Im guessing this goes without saying and there is no way around it but I was hoping that maybe the fact the singleton base class's constructors were private might have prevented this.

Secondly, it seems that unless the class used as the singleton base class's creation policy is declared as a friend in the derived class, the code does not compile saying that the creation policy cannot access the private constructor. Now, although this isnt the end of the world its the final niggle in an otherwise perfect design.

So, hopefully you follow thats not too hard to follow. My question is,does anyone know of any ways around these two issues?

Hopefully someone who knows more than me can shed some insight on this.

Thanks for your time.

Louis Clayton
AnswerRe: Definitive singleton implementation Pin
Ryan Binns24-May-06 14:02
Ryan Binns24-May-06 14:02 
QuestionUI Thread to control CAsyncSocket [modified] Pin
SPowers24-May-06 8:56
SPowers24-May-06 8:56 
AnswerRe: UI Thread to control CAsyncSocket [modified] Pin
David Crow24-May-06 10:30
David Crow24-May-06 10:30 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
SPowers24-May-06 10:35
SPowers24-May-06 10:35 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
David Crow24-May-06 10:52
David Crow24-May-06 10:52 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
SPowers24-May-06 10:56
SPowers24-May-06 10:56 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
David Crow24-May-06 10:58
David Crow24-May-06 10:58 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
SPowers24-May-06 11:11
SPowers24-May-06 11:11 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
SPowers24-May-06 11:17
SPowers24-May-06 11:17 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
Ryan Binns24-May-06 14:03
Ryan Binns24-May-06 14:03 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
SPowers25-May-06 3:03
SPowers25-May-06 3:03 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
Ryan Binns25-May-06 3:32
Ryan Binns25-May-06 3:32 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
SPowers25-May-06 7:36
SPowers25-May-06 7:36 
GeneralRe: UI Thread to control CAsyncSocket [modified] Pin
Ryan Binns25-May-06 13:18
Ryan Binns25-May-06 13:18 
QuestionUser Defined Messages - Value [modified] Pin
Cliff Hatch24-May-06 8:42
Cliff Hatch24-May-06 8:42 
AnswerRe: User Defined Messages - Value [modified] Pin
David Crow24-May-06 10:24
David Crow24-May-06 10:24 
GeneralRe: User Defined Messages - Value [modified] Pin
PJ Arends24-May-06 10:50
professionalPJ Arends24-May-06 10:50 

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.