STEVEN MARX <[EMAIL PROTECTED]> writes:

> I have an array as a class member which is constructed, using new, in a 
> constructor.

If it really is an array, e.g.

  struct Foo {
     int array[5];
  };

then you can't be using new on it. Likely you have not an array,
but a pointer to an array. Or maybe you have an array of pointers. Or
a pointer to an array of pointers.

Post (reduced) actual code, so we don't have to guess.

> The members of the array are pointers to a some class. Should i
> (must i) create a destructor to explicitly
> delete [] or can i rely on the compiler to take care of this
> thank you.

If you new anything in the constructor, then you *must* take care
of that memory in the destructor.

In addition, you must ensure that either the instance can't be
copied, or that it is copied correctly. See "Effective C++", Item 11.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to