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

C / C++ / MFC

 
AnswerRe: Help with no default constructor message .. related question Pin
Richard Andrew x6424-Sep-17 11:39
professionalRichard Andrew x6424-Sep-17 11:39 
If you do,
C++
CObject* ptr = new CObject();

It performs that in two steps:

1. Calls the CObject constructor
2. Then it assigns the instance to the ptr

ptr is uninititalized when the CObject constructor is called. It's not initialized until after the constructor returns.

It might allocate the memory for ptr before it calls the constructor, but it does not contain a useful value. It's uninitialized until the assignment occurs.



The difficult we do right away...
...the impossible takes slightly longer.

GeneralRe: Help with no default constructor message .. related question Pin
ForNow24-Sep-17 12:52
ForNow24-Sep-17 12:52 
GeneralRe: Help with no default constructor message .. related question found answer Pin
ForNow25-Sep-17 8:35
ForNow25-Sep-17 8:35 
AnswerRe: Help with no default constructor message Pin
Jochen Arndt25-Sep-17 21:30
professionalJochen Arndt25-Sep-17 21:30 
GeneralRe: Help with no default constructor message Pin
ForNow26-Sep-17 2:18
ForNow26-Sep-17 2:18 
QuestionProblem in loading c run time library in Visual C++ Pin
Member 1192324422-Sep-17 3:28
Member 1192324422-Sep-17 3:28 
AnswerRe: Problem in loading c run time library in Visual C++ Pin
Jochen Arndt22-Sep-17 3:45
professionalJochen Arndt22-Sep-17 3:45 
GeneralRe: Problem in loading c run time library in Visual C++ Pin
Member 1192324422-Sep-17 4:02
Member 1192324422-Sep-17 4:02 
GeneralRe: Problem in loading c run time library in Visual C++ Pin
enhzflep22-Sep-17 7:42
enhzflep22-Sep-17 7:42 
QuestionSyntax error Pin
Vaclav_21-Sep-17 15:28
Vaclav_21-Sep-17 15:28 
AnswerRe: Syntax error Pin
leon de boer21-Sep-17 16:28
leon de boer21-Sep-17 16:28 
GeneralRe: Syntax error Pin
Vaclav_21-Sep-17 17:02
Vaclav_21-Sep-17 17:02 
AnswerRe: Syntax error Pin
Richard MacCutchan21-Sep-17 21:08
mveRichard MacCutchan21-Sep-17 21:08 
GeneralRe: Syntax error Pin
Vaclav_22-Sep-17 7:00
Vaclav_22-Sep-17 7:00 
AnswerRe: Syntax error Pin
Richard MacCutchan22-Sep-17 7:04
mveRichard MacCutchan22-Sep-17 7:04 
AnswerRe: Syntax error Pin
jschell22-Sep-17 8:44
jschell22-Sep-17 8:44 
GeneralRe: Syntax error Pin
Richard MacCutchan22-Sep-17 21:33
mveRichard MacCutchan22-Sep-17 21:33 
GeneralRe: Syntax error Pin
Vaclav_24-Sep-17 4:42
Vaclav_24-Sep-17 4:42 
GeneralRe: Syntax error Pin
Richard MacCutchan24-Sep-17 5:14
mveRichard MacCutchan24-Sep-17 5:14 
GeneralRe: Syntax error Pin
jschell26-Sep-17 6:15
jschell26-Sep-17 6:15 
GeneralRe: Syntax error Pin
Vaclav_28-Sep-17 7:10
Vaclav_28-Sep-17 7:10 
Questionuser name in system service Pin
john563220-Sep-17 19:31
john563220-Sep-17 19:31 
AnswerRe: user name in system service Pin
Jochen Arndt20-Sep-17 21:25
professionalJochen Arndt20-Sep-17 21:25 
QuestionTCF Eclipse users please reply Pin
Vaclav_20-Sep-17 13:39
Vaclav_20-Sep-17 13:39 
AnswerRe: TCF Eclipse users please reply Pin
Richard MacCutchan20-Sep-17 21:31
mveRichard MacCutchan20-Sep-17 21:31 

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.