Click here to Skip to main content
15,926,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to store the greatest number value? Pin
Antony M Kancidrowski10-Oct-04 9:00
Antony M Kancidrowski10-Oct-04 9:00 
AnswerRe: How to store the greatest number value? Pin
toxcct10-Oct-04 21:21
toxcct10-Oct-04 21:21 
Questionwhy did it thow CFileException::diskFull? Pin
twing9-Oct-04 22:30
twing9-Oct-04 22:30 
Questionbeginner: initializing objects in constructor? Pin
7stud9-Oct-04 17:29
7stud9-Oct-04 17:29 
AnswerRe: beginner: initializing objects in constructor? Pin
Antony M Kancidrowski10-Oct-04 2:57
Antony M Kancidrowski10-Oct-04 2:57 
GeneralRe: beginner: initializing objects in constructor? Pin
7stud10-Oct-04 17:49
7stud10-Oct-04 17:49 
GeneralRe: beginner: initializing objects in constructor? Pin
Antony M Kancidrowski11-Oct-04 5:09
Antony M Kancidrowski11-Oct-04 5:09 
GeneralRe: beginner: initializing objects in constructor? Pin
7stud11-Oct-04 8:58
7stud11-Oct-04 8:58 
This is what you said:
-------
"If you take a look at the header file for the dialog you will see a line like

CListBox m_ListBoxControl;

This instantiates a CListBox object and calls its constructor."
-------

My test code shows that your statement is incorrect--just declaring a member object in a .h file does not instantiate the object and call it's constructor. Now, you seem to be saying something different.

Anyway, as far as I can tell, the class Wizard never instantiates the object in a .cpp file with a line like:

CListBox m_ListBoxControl;

which would create the object and call it's default constructor. But, I don't think a statement like that is appropriate for a class member anyways--I think object members of a class get instantiated when an object of the class is created.

I do see this line:

CCodeProject_Dialog2Dlg dlg;

in CCodeProject_Dialog2App::InitInstance(). I guess that must call the default contructor of the object m_ListBoxControl because it's a member of the CCodeProject_Dialog2Dlg class, and in the creation of 'dlg' it gets called somehow.

However, looking around the files, now I don't see the default constructor that's called for 'dlg':

CCodeProject_Dialog2Dlg dlg;

The only constructor I see is:
-------
CCodeProject_Dialog2Dlg::CCodeProject_Dialog2Dlg(CWnd* pParent /*=NULL*/)
: CDialog(CCodeProject_Dialog2Dlg::IDD, pParent)
-------

which has one paramemter, so it can't be the defautlt constructor, and if the programmer defines a constructor, then they have to provide their own default constructor. Where is the default constructor that's called?









GeneralRe: beginner: initializing objects in constructor? Pin
Antony M Kancidrowski11-Oct-04 11:05
Antony M Kancidrowski11-Oct-04 11:05 
GeneralRe: beginner: initializing objects in constructor? Pin
7stud12-Oct-04 0:40
7stud12-Oct-04 0:40 
GeneralRe: beginner: initializing objects in constructor? Pin
Antony M Kancidrowski12-Oct-04 2:54
Antony M Kancidrowski12-Oct-04 2:54 
GeneralEmbarsssing Menu Question Pin
...---...9-Oct-04 16:52
...---...9-Oct-04 16:52 
GeneralRe: Embarsssing Menu Question Pin
X204010-Oct-04 0:00
X204010-Oct-04 0:00 
GeneralComboBox Dumb Question Pin
otrcomm9-Oct-04 16:01
otrcomm9-Oct-04 16:01 
GeneralRe: ComboBox Dumb Question Pin
Michael Dunn9-Oct-04 16:48
sitebuilderMichael Dunn9-Oct-04 16:48 
GeneralRe: ComboBox Dumb Question Pin
otrcomm9-Oct-04 17:17
otrcomm9-Oct-04 17:17 
Generaldoing evil to Critical Section Pin
peterchen9-Oct-04 14:31
peterchen9-Oct-04 14:31 
GeneralRe: doing evil to Critical Section Pin
geo_m9-Oct-04 20:28
geo_m9-Oct-04 20:28 
GeneralHelp needed on file handling... Pin
Kiran Satish9-Oct-04 14:26
Kiran Satish9-Oct-04 14:26 
QuestionHow to bind data from database to a combobox in Dialog? Pin
tip23109-Oct-04 13:00
tip23109-Oct-04 13:00 
General3D-rotaion in VC++ Pin
huffmancoding9-Oct-04 12:21
huffmancoding9-Oct-04 12:21 
GeneralRe: 3D-rotaion in VC++ Pin
alex.barylski9-Oct-04 13:25
alex.barylski9-Oct-04 13:25 
GeneralRe: 3D-rotaion in VC++ Pin
Anonymous9-Oct-04 15:55
Anonymous9-Oct-04 15:55 
GeneralGetting text from combo box control Pin
7stud9-Oct-04 10:55
7stud9-Oct-04 10:55 
GeneralRe: Getting text from combo box control Pin
Wes Aday9-Oct-04 11:08
professionalWes Aday9-Oct-04 11:08 

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.