Item 16: Use the Same Form in Corresponding Uses of new and delete
delete
-for-new
and delete[]
-for-new[]
.
-
All constructors should use the same form of
new
so that destructor may use the correct form ofdelete
. -
Don’t
typedef
array type, which may result in mismatchednew
anddelete
form if you aren’t careful.
Aside: Arrays just don’t mix well with modern C++. You should avoid them as much as you can.