Click here to Skip to main content
15,886,518 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Declaring Variables Pin
Maximilien4-Feb-10 8:19
Maximilien4-Feb-10 8:19 
GeneralRe: Declaring Variables Pin
gregarion4-Feb-10 8:34
gregarion4-Feb-10 8:34 
GeneralRe: Declaring Variables Pin
Richard MacCutchan4-Feb-10 8:47
mveRichard MacCutchan4-Feb-10 8:47 
GeneralRe: Declaring Variables Pin
gregarion4-Feb-10 8:53
gregarion4-Feb-10 8:53 
GeneralRe: Declaring Variables Pin
Richard MacCutchan4-Feb-10 11:38
mveRichard MacCutchan4-Feb-10 11:38 
GeneralRe: Declaring Variables Pin
Rozis4-Feb-10 12:42
Rozis4-Feb-10 12:42 
GeneralRe: Declaring Variables Pin
Richard MacCutchan4-Feb-10 22:04
mveRichard MacCutchan4-Feb-10 22:04 
GeneralRe: Declaring Variables Pin
Maximilien4-Feb-10 8:55
Maximilien4-Feb-10 8:55 
Well, you need something to "hold" the data that class A will retrieve.

for example If class A is simply reading data from a file, then class B could hold the data for it.

For example in MFC, you have the class CStdioFile that only reads text from a file, but in a software that use that class, I will need something to hold the text (for example a vector of text lines that are read).

Another variation, sometimes if the class is more or less specialized it could be used to read and hold data at the same time.

for example I could have a class MyStdIoFile that is derived from CStdioFile that will not only read from the file, but store the data internally.

class MyStdIoFile : public CStdioFile 
{
  public:
   Read( CString path ){/* call code from CStdIoFile to read and put it in m_Data*/  };

  protected:
   vector<CString> m_Data;
}


again, there are tons of different ways of doing this, it's more a question of design than a question of code; who reads, who writes. who keep the data, who display the data, how is it read, how is it kept, how is it displayed.

Take a piece of paper and draw littles boxes representing your different objects and draw lines and arrows between them to show the relationships.

This signature was proudly tested on animals.

GeneralRe: Declaring Variables Pin
gregarion4-Feb-10 8:59
gregarion4-Feb-10 8:59 
QuestionMessage Removed Pin
4-Feb-10 7:20
glitteringsound4-Feb-10 7:20 
AnswerRe: Code needed for Parsing PE for Exports Pin
Tim Craig4-Feb-10 8:32
Tim Craig4-Feb-10 8:32 
AnswerRe: Code needed for Parsing PE for Exports Pin
Richard MacCutchan4-Feb-10 8:45
mveRichard MacCutchan4-Feb-10 8:45 
QuestionC++ return value from function Pin
uusheikh4-Feb-10 7:11
uusheikh4-Feb-10 7:11 
AnswerRe: C++ return value from function Pin
Nemanja Trifunovic4-Feb-10 7:27
Nemanja Trifunovic4-Feb-10 7:27 
GeneralRe: C++ return value from function Pin
uusheikh4-Feb-10 7:35
uusheikh4-Feb-10 7:35 
GeneralRe: C++ return value from function Pin
Maximilien4-Feb-10 7:38
Maximilien4-Feb-10 7:38 
GeneralRe: C++ return value from function Pin
Nemanja Trifunovic4-Feb-10 7:43
Nemanja Trifunovic4-Feb-10 7:43 
GeneralRe: C++ return value from function Pin
uusheikh4-Feb-10 8:18
uusheikh4-Feb-10 8:18 
GeneralRe: C++ return value from function Pin
peterchen4-Feb-10 23:59
peterchen4-Feb-10 23:59 
AnswerRe: C++ return value from function Pin
David Crow4-Feb-10 8:33
David Crow4-Feb-10 8:33 
AnswerRe: C++ return value from function Pin
fat_boy5-Feb-10 1:17
fat_boy5-Feb-10 1:17 
QuestionCMiniFrameWnd Pin
Vaclav_4-Feb-10 4:25
Vaclav_4-Feb-10 4:25 
QuestionCppUnit testing Pin
gregarion4-Feb-10 2:40
gregarion4-Feb-10 2:40 
QuestionRe: CppUnit testing Pin
David Crow4-Feb-10 4:46
David Crow4-Feb-10 4:46 
AnswerRe: CppUnit testing Pin
gregarion4-Feb-10 4:48
gregarion4-Feb-10 4:48 

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.