Deleting class pointer arrays.

Feb 3, 2015 at 1:19pm
Hello!
If i have a pointer array of classes, e.g. MyClass *foo;
and if i try to delete this pointer delete [] foo; does it call a destructor of a class, or wahat happens? this is because i have another pointers in that class which are cleared in destructor.
Feb 3, 2015 at 1:37pm
Yes.
http://en.cppreference.com/w/cpp/language/delete
Example in http://www.cplusplus.com/reference/new/operator%20delete%5B%5D/


PS. You don't "delete pointer". You delete the memory pointed to by the pointer.
Topic archived. No new replies allowed.