Click here to Skip to main content
15,888,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How explicit , volatile and mutable keywords works INTERNALLY in C++ ? Pin
leon de boer7-Nov-16 8:15
leon de boer7-Nov-16 8:15 
GeneralPlease help Pin
Ahmed Adel5-Nov-16 3:20
Ahmed Adel5-Nov-16 3:20 
GeneralRe: Please help Pin
Richard MacCutchan5-Nov-16 21:01
mveRichard MacCutchan5-Nov-16 21:01 
GeneralRe: Please help Pin
leon de boer6-Nov-16 4:49
leon de boer6-Nov-16 4:49 
PraiseRe: Please help Pin
Ahmed Adel6-Nov-16 5:10
Ahmed Adel6-Nov-16 5:10 
QuestionPattern review C++: using structs with pure virtual methods in place of interfaces Pin
Member 128328324-Nov-16 5:58
Member 128328324-Nov-16 5:58 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
Chris Losinger4-Nov-16 8:23
professionalChris Losinger4-Nov-16 8:23 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
leon de boer4-Nov-16 8:48
leon de boer4-Nov-16 8:48 
I tend to do exactly the same mainly because if I need I can transfer my C++ code easily to pure C, C# and into VHDL if working with FPGA's. Some will find our coding quirky because they have not come from that interface background but at the end of the day your code is tight and usually more portable to other languages when you need. Personally I think it's a good trait but those who only write in C++ will argue we aren't using the language to it's full ability.

Do you go the whole hog Smile | :)

I import multiple interfaces into things I never do C++ multiple inheritance at all. I also run my own form of delegates, mine is closer to C# that the standard C++ setup.

The final thing I do is probably very quirky to my embedded background, in that all my interfaces have an abstract event drive message function call set on them. Generally it will be unimplemented but the number of times it has saved my butt when I need complicated exchanges across the interfaces to synchronize them or often I use it for live debugging. Saves hours of time if you can connect to a locked program and actually look at the interface states. To do that you simply setup the event drive message pump in it's own thread and so you can actually push messages to get the interface states even though the program thread may be deadlocked.

The only downside is in team developments some will struggle to understand your code because it isn't the purest standard C++ form. On the couple of times I ever had that happen I just hide the interfaces inside a wrapper class, sort of where your sample is going. I normally don't hide the interfaces they just sit as exposed public on a class because they are an designed as a proper interface after all.

So like Chris said I am a PIMPL guy as well Smile | :)
In vino veritas


modified 4-Nov-16 14:57pm.

AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
«_Superman_»5-Nov-16 21:42
professional«_Superman_»5-Nov-16 21:42 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
Daniel Pfeffer6-Nov-16 0:35
professionalDaniel Pfeffer6-Nov-16 0:35 
QuestionMouse out of dialog Pin
_Flaviu3-Nov-16 4:07
_Flaviu3-Nov-16 4:07 
AnswerRe: Mouse out of dialog Pin
leon de boer3-Nov-16 4:21
leon de boer3-Nov-16 4:21 
QuestionRe: Mouse out of dialog Pin
David Crow3-Nov-16 15:42
David Crow3-Nov-16 15:42 
AnswerRe: Mouse out of dialog Pin
_Flaviu3-Nov-16 21:44
_Flaviu3-Nov-16 21:44 
GeneralRe: Mouse out of dialog Pin
Richard MacCutchan3-Nov-16 22:04
mveRichard MacCutchan3-Nov-16 22:04 
GeneralRe: Mouse out of dialog Pin
leon de boer3-Nov-16 22:10
leon de boer3-Nov-16 22:10 
GeneralRe: Mouse out of dialog Pin
_Flaviu3-Nov-16 23:12
_Flaviu3-Nov-16 23:12 
QuestionSharing some humour Pin
leon de boer2-Nov-16 5:40
leon de boer2-Nov-16 5:40 
JokeRe: Sharing some humour Pin
Randor 2-Nov-16 17:34
professional Randor 2-Nov-16 17:34 
GeneralRe: Sharing some humour Pin
leon de boer2-Nov-16 18:57
leon de boer2-Nov-16 18:57 
AnswerRe: Sharing some humour Pin
Daniel Pfeffer2-Nov-16 22:23
professionalDaniel Pfeffer2-Nov-16 22:23 
GeneralRe: Sharing some humour Pin
leon de boer3-Nov-16 3:14
leon de boer3-Nov-16 3:14 
GeneralRe: Sharing some humour Pin
Daniel Pfeffer3-Nov-16 3:34
professionalDaniel Pfeffer3-Nov-16 3:34 
GeneralRe: Sharing some humour Pin
leon de boer3-Nov-16 4:41
leon de boer3-Nov-16 4:41 
GeneralRe: Sharing some humour Pin
Randor 13-Nov-16 5:43
professional Randor 13-Nov-16 5:43 

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.