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

C / C++ / MFC

 
GeneralRe: VAssistX Pin
RChin1-Feb-06 6:50
RChin1-Feb-06 6:50 
GeneralRe: VAssistX Pin
toxcct1-Feb-06 6:52
toxcct1-Feb-06 6:52 
GeneralRe: VAssistX Pin
RChin1-Feb-06 7:14
RChin1-Feb-06 7:14 
GeneralRe: VAssistX Pin
toxcct1-Feb-06 7:15
toxcct1-Feb-06 7:15 
GeneralRe: VS 2003 issue Pin
Prakash Nadar1-Feb-06 16:51
Prakash Nadar1-Feb-06 16:51 
JokeRe: VS 2003 issue Pin
toxcct1-Feb-06 21:56
toxcct1-Feb-06 21:56 
JokeRe: VS 2003 issue Pin
Owner drawn2-Feb-06 17:33
Owner drawn2-Feb-06 17:33 
QuestionWhat's the difference? Pin
tas28261-Feb-06 5:34
tas28261-Feb-06 5:34 
I am curious about something dealing with constructors in dialog classes. I have seen a certain way of doing the constructor and I wonder if it actually buys anything. Here is what I am talking about:

FOO::FOO(CWnd* pParent /*=NULL*/)
: CDialog(FOO::IDD, pParent),
m_pSomeObject( NULL ),
m_bSomeBoolean( false ),
m_iSomeInt( 0 ),
m_sSomeString( "" )
{
//{{AFX_DATA_INIT(FOO)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}

Now m_pSomeObject, m_bSomeBoolean, m_iSomeInt, and m_sSomeString are member variables of the class. So, they are being initialized. Is this method of defining a constructor better than doing it this way?

FOO::FOO(CWnd* pParent /*=NULL*/)
: CDialog(FOO::IDD, pParent)
{
//{{AFX_DATA_INIT(FOO)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_pSomeObject = NULL;
m_bSomeBoolean = false;
m_iSomeInt = 0;
m_sSomeString = "";
}

It is not importaint that it be a dialog class, this is just where I am seeing it used. I am just wondering what the advantages of one over the other are, or if there are advantages?


Thanks,
Troy
AnswerRe: What's the difference? Pin
Rama Krishna Vavilala1-Feb-06 5:58
Rama Krishna Vavilala1-Feb-06 5:58 
GeneralRe: What's the difference? Pin
tas28261-Feb-06 6:10
tas28261-Feb-06 6:10 
GeneralRe: What's the difference? Pin
Nish Nishant1-Feb-06 6:13
sitebuilderNish Nishant1-Feb-06 6:13 
GeneralRe: What's the difference? Pin
tas28261-Feb-06 6:18
tas28261-Feb-06 6:18 
GeneralRe: What's the difference? Pin
Nish Nishant1-Feb-06 6:12
sitebuilderNish Nishant1-Feb-06 6:12 
AnswerRe: What's the difference? Pin
David Crow1-Feb-06 6:29
David Crow1-Feb-06 6:29 
AnswerRe: What's the difference? Pin
tas28261-Feb-06 6:41
tas28261-Feb-06 6:41 
GeneralRe: What's the difference? Pin
Ryan Binns1-Feb-06 17:42
Ryan Binns1-Feb-06 17:42 
AnswerRe: What's the difference? Pin
Eric Jacobsen1-Feb-06 10:49
Eric Jacobsen1-Feb-06 10:49 
AnswerRe: What's the difference? Pin
Owner drawn1-Feb-06 16:59
Owner drawn1-Feb-06 16:59 
QuestionExporting dialog resources Pin
tas28261-Feb-06 5:12
tas28261-Feb-06 5:12 
AnswerRe: Exporting dialog resources Pin
David Crow1-Feb-06 5:15
David Crow1-Feb-06 5:15 
GeneralRe: Exporting dialog resources Pin
tas28261-Feb-06 5:41
tas28261-Feb-06 5:41 
AnswerRe: Exporting dialog resources Pin
Maximilien1-Feb-06 5:55
Maximilien1-Feb-06 5:55 
QuestionFont size: point ang logic Pin
includeh101-Feb-06 4:47
includeh101-Feb-06 4:47 
AnswerRe: Font size: point ang logic Pin
Shog91-Feb-06 15:55
sitebuilderShog91-Feb-06 15:55 
Questionwhen to upgrade vc6? Pin
ehh1-Feb-06 4:16
ehh1-Feb-06 4:16 

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.