Click here to Skip to main content
15,847,583 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 9:15
leon de boer7-Nov-16 9:15 
GeneralPlease help Pin
Ahmed Adel5-Nov-16 4:20
Ahmed Adel5-Nov-16 4:20 
GeneralRe: Please help Pin
Richard MacCutchan5-Nov-16 22:01
mveRichard MacCutchan5-Nov-16 22:01 
GeneralRe: Please help Pin
leon de boer6-Nov-16 5:49
leon de boer6-Nov-16 5:49 
PraiseRe: Please help Pin
Ahmed Adel6-Nov-16 6:10
Ahmed Adel6-Nov-16 6:10 
QuestionPattern review C++: using structs with pure virtual methods in place of interfaces Pin
Member 128328324-Nov-16 6:58
Member 128328324-Nov-16 6:58 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
Chris Losinger4-Nov-16 9:23
professionalChris Losinger4-Nov-16 9:23 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
leon de boer4-Nov-16 9:48
leon de boer4-Nov-16 9: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 22:42
professional«_Superman_»5-Nov-16 22:42 
AnswerRe: Pattern review C++: using structs with pure virtual methods in place of interfaces Pin
Daniel Pfeffer6-Nov-16 1:35
professionalDaniel Pfeffer6-Nov-16 1:35 
QuestionMouse out of dialog Pin
_Flaviu3-Nov-16 5:07
_Flaviu3-Nov-16 5:07 
AnswerRe: Mouse out of dialog Pin
leon de boer3-Nov-16 5:21
leon de boer3-Nov-16 5:21 
QuestionRe: Mouse out of dialog Pin
David Crow3-Nov-16 16:42
David Crow3-Nov-16 16:42 
AnswerRe: Mouse out of dialog Pin
_Flaviu3-Nov-16 22:44
_Flaviu3-Nov-16 22:44 
GeneralRe: Mouse out of dialog Pin
Richard MacCutchan3-Nov-16 23:04
mveRichard MacCutchan3-Nov-16 23:04 
GeneralRe: Mouse out of dialog Pin
leon de boer3-Nov-16 23:10
leon de boer3-Nov-16 23:10 
GeneralRe: Mouse out of dialog Pin
_Flaviu4-Nov-16 0:12
_Flaviu4-Nov-16 0:12 
QuestionSharing some humour Pin
leon de boer2-Nov-16 6:40
leon de boer2-Nov-16 6:40 
JokeRe: Sharing some humour Pin
Randor 2-Nov-16 18:34
professional Randor 2-Nov-16 18:34 
GeneralRe: Sharing some humour Pin
leon de boer2-Nov-16 19:57
leon de boer2-Nov-16 19:57 
AnswerRe: Sharing some humour Pin
Daniel Pfeffer2-Nov-16 23:23
professionalDaniel Pfeffer2-Nov-16 23:23 
GeneralRe: Sharing some humour Pin
leon de boer3-Nov-16 4:14
leon de boer3-Nov-16 4:14 
GeneralRe: Sharing some humour Pin
Daniel Pfeffer3-Nov-16 4:34
professionalDaniel Pfeffer3-Nov-16 4:34 
GeneralRe: Sharing some humour Pin
leon de boer3-Nov-16 5:41
leon de boer3-Nov-16 5:41 
GeneralRe: Sharing some humour Pin
Randor 13-Nov-16 6:43
professional Randor 13-Nov-16 6: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.