Click here to Skip to main content
15,895,084 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: hiding a dialog? Pin
namaskaaram8-Mar-05 4:51
namaskaaram8-Mar-05 4:51 
QuestionFit a dialog into a view? Pin
rgchezhian8-Mar-05 4:20
rgchezhian8-Mar-05 4:20 
AnswerRe: Fit a dialog into a view? Pin
Chris Losinger8-Mar-05 5:39
professionalChris Losinger8-Mar-05 5:39 
GeneralRe: Fit a dialog into a view? Pin
rgchezhian8-Mar-05 22:06
rgchezhian8-Mar-05 22:06 
QuestionHow to call a constructor in another constructor Pin
Member 341378-Mar-05 4:13
Member 341378-Mar-05 4:13 
AnswerRe: How to call a constructor in another constructor Pin
namaskaaram8-Mar-05 4:28
namaskaaram8-Mar-05 4:28 
AnswerRe: How to call a constructor in another constructor Pin
CP Visitor8-Mar-05 5:40
CP Visitor8-Mar-05 5:40 
GeneralRe: How to call a constructor in another constructor Pin
TheGreatAndPowerfulOz8-Mar-05 6:20
TheGreatAndPowerfulOz8-Mar-05 6:20 
Sorry, but that link is not correct. at least not completely.

The way to call one constructor from another is to use "placement new".

For example:

Foo::Foo()
{
int i;
new (this)Foo(i); // this will call the Foo::Foo(int) ctor without allocating memory
}

Foo::Foo(int)
{
}

This begs the question of why you want to do this. If it is for "common" initialization code, the better answer is to have a separate initialization function, as in the following. Then call that init code either from each ctor, or perhaps better, to call it from the places where Foo is constructed. then maybe handle init failures there.

bool Foo:init(some parameters here maybe)
{
// do init code here
}

GeneralRe: How to call a constructor in another constructor Pin
basementman8-Mar-05 7:09
basementman8-Mar-05 7:09 
GeneralRe: How to call a constructor in another constructor Pin
Anonymous8-Mar-05 11:48
Anonymous8-Mar-05 11:48 
GeneralRe: How to call a constructor in another constructor Pin
basementman8-Mar-05 12:30
basementman8-Mar-05 12:30 
GeneralRe: How to call a constructor in another constructor Pin
Andrew Walker8-Mar-05 11:44
Andrew Walker8-Mar-05 11:44 
GeneralRe: How to call a constructor in another constructor Pin
TheGreatAndPowerfulOz8-Mar-05 17:00
TheGreatAndPowerfulOz8-Mar-05 17:00 
GeneralRe: How to call a constructor in another constructor Pin
Mouse on Mars8-Mar-05 23:13
sussMouse on Mars8-Mar-05 23:13 
GeneralRe: How to call a constructor in another constructor Pin
TheGreatAndPowerfulOz9-Mar-05 14:45
TheGreatAndPowerfulOz9-Mar-05 14:45 
AnswerRe: How to call a constructor in another constructor Pin
Ravi Bhavnani8-Mar-05 9:50
professionalRavi Bhavnani8-Mar-05 9:50 
QuestionHow to end process tree? Pin
lechoo8-Mar-05 3:56
lechoo8-Mar-05 3:56 
GeneralRegistry Hacking Pin
shahzad Ahmed8-Mar-05 3:36
shahzad Ahmed8-Mar-05 3:36 
GeneralRegistry Hacking Pin
shahzad Ahmed8-Mar-05 3:33
shahzad Ahmed8-Mar-05 3:33 
GeneralRe: Registry Hacking Pin
David Crow8-Mar-05 4:07
David Crow8-Mar-05 4:07 
QuestionWhy display icon in ListCtrl with a black shadow ?? Pin
lillah8-Mar-05 3:00
lillah8-Mar-05 3:00 
GeneralDLL Extension MFC Pin
sunit58-Mar-05 2:26
sunit58-Mar-05 2:26 
GeneralRe: DLL Extension MFC Pin
ThatsAlok8-Mar-05 2:58
ThatsAlok8-Mar-05 2:58 
GeneralRe: DLL Extension MFC Pin
sunit58-Mar-05 20:23
sunit58-Mar-05 20:23 
GeneralAllocating struct with malloc, shows as undefined in Visual C++ debugger Pin
Dave J Smith8-Mar-05 1:18
Dave J Smith8-Mar-05 1:18 

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.