Click here to Skip to main content
16,010,553 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Details on printing from CEditView in an SDI app Pin
Cool Ju17-Nov-05 17:01
Cool Ju17-Nov-05 17:01 
GeneralRe: Details on printing from CEditView in an SDI app Pin
Mark F.18-Nov-05 2:52
Mark F.18-Nov-05 2:52 
QuestionLPtoDP function is not working Pin
BuckBrown17-Nov-05 12:17
BuckBrown17-Nov-05 12:17 
AnswerRe: LPtoDP function is not working Pin
Cool Ju17-Nov-05 16:49
Cool Ju17-Nov-05 16:49 
GeneralRe: LPtoDP function is not working Pin
BuckBrown18-Nov-05 6:07
BuckBrown18-Nov-05 6:07 
QuestionSaving Bitmap Pin
mpastchenko17-Nov-05 11:59
mpastchenko17-Nov-05 11:59 
AnswerRe: Saving Bitmap Pin
Christian Graus17-Nov-05 14:21
protectorChristian Graus17-Nov-05 14:21 
QuestionC++ question Pin
David Crow17-Nov-05 8:57
David Crow17-Nov-05 8:57 
Consider the following:

class A
{
    recipient;
    queue;
};
 
class B
{
    recipient;
    queue;
    text;
    from;
};
 
A a;
B b;
 
if (some_condition)
    modify a.recipient, a.queue;

else
    modify b.recipient, b.queue, b.text, b.from;
...
if (some_condition)
    modify a.recipient, a.queue;
else
    modify b.recipient, b.queue, b.text, b.from;
This code that modifies the various members is repeated dozens of times. I would like to somehow instantiate just one of either A or B so that the code that modifies the common member variables can do so without having to use a runtime condition. Something like:

modify b.recipient, b.queue;

if (some_condition)
    modify b.text, b.from;
I thought that I could put the common member variables into a base class and derive A and B from that, but nothing I tried would satisy the compiler. Modify the member variables through the base class and it would complain about text and from. Modify the member variables through the derived class and it would complain about recipient and queue.

One or other of the two classes will eventually be sent to another computer. That computer is expecting data of a certain size. In other words, I can't operate on B if the other computer is expecting A and vice versa.

Thanks,
DC


"Take only what you need and leave the land as you found it." - Native American Proverb


AnswerRe: C++ question Pin
Chris Meech17-Nov-05 10:29
Chris Meech17-Nov-05 10:29 
AnswerRe: C++ question Pin
Owner drawn17-Nov-05 17:39
Owner drawn17-Nov-05 17:39 
GeneralRe: C++ question Pin
David Crow18-Nov-05 5:19
David Crow18-Nov-05 5:19 
GeneralRe: C++ question Pin
cmk18-Nov-05 13:09
cmk18-Nov-05 13:09 
GeneralRe: C++ question Pin
David Crow19-Nov-05 7:06
David Crow19-Nov-05 7:06 
GeneralRe: C++ question Pin
Owner drawn20-Nov-05 17:52
Owner drawn20-Nov-05 17:52 
GeneralRe: C++ question Pin
David Crow21-Nov-05 3:10
David Crow21-Nov-05 3:10 
AnswerRe: C++ question Pin
cmk18-Nov-05 2:19
cmk18-Nov-05 2:19 
QuestionDLL Function Noobie Pin
tadieckmann17-Nov-05 8:03
tadieckmann17-Nov-05 8:03 
AnswerRe: DLL Function Noobie Pin
kakan17-Nov-05 20:31
professionalkakan17-Nov-05 20:31 
Questionoddities of visual studio.net 2005.... Pin
(Steven Hicks)n+117-Nov-05 6:52
(Steven Hicks)n+117-Nov-05 6:52 
QuestionThreads in MFC - trying to understand... Pin
charlieg17-Nov-05 6:44
charlieg17-Nov-05 6:44 
AnswerRe: Threads in MFC - trying to understand... Pin
David Crow17-Nov-05 8:56
David Crow17-Nov-05 8:56 
GeneralRe: Threads in MFC - trying to understand... Pin
charlieg17-Nov-05 9:00
charlieg17-Nov-05 9:00 
AnswerRe: Threads in MFC - trying to understand... Pin
Sheng Jiang 蒋晟17-Nov-05 12:44
Sheng Jiang 蒋晟17-Nov-05 12:44 
GeneralRe: Threads in MFC - trying to understand... Pin
charlieg17-Nov-05 13:55
charlieg17-Nov-05 13:55 
GeneralRe: Threads in MFC - trying to understand... Pin
Sheng Jiang 蒋晟17-Nov-05 14:17
Sheng Jiang 蒋晟17-Nov-05 14:17 

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.