Click here to Skip to main content
15,903,388 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionClass Bascis Question... Pin
HakunaMatada6-May-06 1:55
HakunaMatada6-May-06 1:55 
AnswerRe: Class Bascis Question... Pin
Cedric Moonen6-May-06 2:03
Cedric Moonen6-May-06 2:03 
GeneralRe: Class Bascis Question... Pin
Stephen Hewitt6-May-06 2:44
Stephen Hewitt6-May-06 2:44 
AnswerRe: Class Bascis Question... Pin
Stephen Hewitt6-May-06 2:34
Stephen Hewitt6-May-06 2:34 
GeneralRe: Class Bascis Question... Pin
HakunaMatada6-May-06 2:51
HakunaMatada6-May-06 2:51 
GeneralRe: Class Bascis Question... Pin
Stephen Hewitt6-May-06 2:55
Stephen Hewitt6-May-06 2:55 
GeneralRe: Class Bascis Question... Pin
led mike6-May-06 6:11
led mike6-May-06 6:11 
AnswerRe: Class Bascis Question... Pin
Maxwell Chen6-May-06 3:31
Maxwell Chen6-May-06 3:31 
In addition to their answers, here is the 3rd reason.

When you declare an object as the data member, you have to include the .H file of the implementation. As:
// file foo.h
#include "bar.h"
class foo
{
  bar  _MyBar;
  // ...
};
Any changes to the implementation of class bar will cause class foo to be re-compiled again. This is nothing in small projects, but it is quite annoying in large projects. (The case you click [Build] button, you go out to buy a cup of coffee, and you go back 10 minutes later... You see it is still compiling.)

So we would take this way as:
// file foo.h
// #include "bar.h"
class bar;  // <----------
class foo
{
  //  bar  _MyBar;
  bar*  _pMyBar;  // <-----------
  // ...
};



Maxwell Chen

-- modified at 10:24 Saturday 6th May, 2006
GeneralRe: Class Bascis Question... Pin
Stephen Hewitt6-May-06 3:54
Stephen Hewitt6-May-06 3:54 
GeneralRe: Class Bascis Question... Pin
Axter6-May-06 16:43
professionalAxter6-May-06 16:43 
GeneralRe: Class Bascis Question... Pin
Stephen Hewitt6-May-06 18:32
Stephen Hewitt6-May-06 18:32 
GeneralRe: Class Bascis Question... Pin
Maxwell Chen6-May-06 19:16
Maxwell Chen6-May-06 19:16 
GeneralRe: Class Bascis Question... Pin
Phil C6-May-06 20:12
Phil C6-May-06 20:12 
AnswerRe: Class Bascis Question... Pin
Maxwell Chen6-May-06 20:44
Maxwell Chen6-May-06 20:44 
GeneralRe: Class Bascis Question... Pin
Axter7-May-06 1:05
professionalAxter7-May-06 1:05 
GeneralRe: Class Bascis Question... Pin
Maxwell Chen7-May-06 2:02
Maxwell Chen7-May-06 2:02 
GeneralRe: Class Bascis Question... Pin
Axter7-May-06 5:53
professionalAxter7-May-06 5:53 
GeneralRe: Class Bascis Question... Pin
Maxwell Chen7-May-06 6:22
Maxwell Chen7-May-06 6:22 
GeneralRe: Class Bascis Question... Pin
Axter7-May-06 1:20
professionalAxter7-May-06 1:20 
QuestionRe: Class Bascis Question... Pin
Maxwell Chen7-May-06 2:08
Maxwell Chen7-May-06 2:08 
AnswerRe: Class Bascis Question... Pin
Axter7-May-06 5:57
professionalAxter7-May-06 5:57 
GeneralRe: Class Bascis Question... Pin
Maxwell Chen7-May-06 6:08
Maxwell Chen7-May-06 6:08 
Questionhow to get ip address of my own system Pin
noumanzaidi6-May-06 1:39
noumanzaidi6-May-06 1:39 
AnswerRe: how to get ip address of my own system Pin
Hamid_RT6-May-06 1:48
Hamid_RT6-May-06 1:48 
AnswerRe: how to get ip address of my own system Pin
Mila0257-May-06 21:19
Mila0257-May-06 21:19 

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.