CArray<object, object&> TheArray;

My book says its important to call the SetSize() member function of CArray to fix the initial number of elements. SetSize() in turn calls a global helper function ConstructElements() which allocates memory for the number of elements. It says the default version sets the contents of the allocated memory to zero and doesn't call a constructor for your object class. However, you have to implement your own version of ConstructElements() if space for data members of objects of your class is allocated dynamically, or if there is initialization required.

1)Why do you have to do something different for objects with dynamically allocated data members? And, how is memory allocated in the first place without calling the constructor--with something like sizeof(object)?

2)How would you implement ConstructElements() for a simple class like:
class A
     A(int a)
          pint = new int;
          *pint = a; 

     int* pint;