How do I make a constructor for a Dialog that I call with: CMyDlg ( /* int */ ArraySize) ? 
Author Message
 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

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];



    delete [] m_pDoubleArray;


What do I make wrong ??

Mon, 31 Jul 2000 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Calling int f(int (*f)(int)) like function in DLL from VB

2. constructor that calls a constructor

3. Calling Default Constructor from another constructor

4. Call other constructor in a constructor

5. Can you call a default constructor from an overloaded constructor

6. Calling a constructor from a constructor

7. destructor is called before copy-constructor on temporary class (allocated on stack during function call)

8. Not making default copy constructor

9. Enter key on dialog embedded in dialog not doing OnOK

10. int func(int) versus int func(int *) efficacy.

11. Color(int r, int g, int b) struct constructor?

12. Sign extending with making unsigned int from char


Powered by phpBB® Forum Software