| re: call null constructor from another constructor
Matt Graham wrote:
[color=blue]
> Here's a subset of a class I'm trying to initialize:
>
> class uiForm {[/color]
private:[color=blue]
> unsigned short m_method;
> unsigned short m_form_id;
> FormType *m_frmP;
> char *m_title;
> public:
> uiForm(unsigned short);
> uiForm(void);
> };
>
> I have this
>
> uiForm::uiForm(): m_method(1),
> m_form_id(0), m_frmP(0), m_title(0) { }
>
> as my [default] constructor and the [explicit] constructor below
>
> uiForm::uiForm(unsigned short frm_id): m_method(1),
> m_form_id(frm_id), m_frmP(0), m_title(0) { }
>
> is passed an integer to set one of the parameters.
> But I want the rest of the data to be initialized
> the same as in the [default] constructor.
> Now, what I'm wondering is if there is a way
> I can have integer constructor call the [default] constructor
> and then I can initialize the one m_form_id value explicitly.[/color]
No. |