
How do I make a constructor for a Dialog that I call with: CMyDlg ( /* int */ ArraySize) ?
I'm making a dialog box where there will be ArraySize number of edit boxes.
And ArraySize is not known until at run-time.
In my first version I made the memory allocation in InitDialog, and
everything worked fine. But then I got the idea to avoid memory allocation
in InitDialog, and do it in the constructor instead. That doesn't work.
Maybe it is my constructor that is not that good ?
My new (additional) constructor where all the memory allocation is
performed:
CMyDlg::CMyDlg(int ArraySize, CWnd* pParent /*=NULL*/)
: CDialog(CBinaryInteractionsDlg::IDD, pParent)
{
// m_pDoubleArray is a double* and a member variable.
m_pDoubleArray = new double [ArraySize];
Quote:
}
Destructor:
CMyDlg::~CMyDlg()
{
delete [] m_pDoubleArray;
Quote:
}
What do I make wrong ??