On Thu, 17 Sep 1998, Niels Hald Pedersen wrote:
->> class foo
->> {
->> private:
->> char *c;
->>
->> public:
->> foo() // constructor
->> { c = new char [LEN + 1]; }
->>
->> };
->>
->basically yes, but as c is really an array, you should write
->
-> delete [] c;
->
->instead (dont know precisely what the mechanism are, but it instructs
->the compiler to look somewhere for the size of the array pointed at
->(probably written in allocated block below official address)).
->
not to be picky but
delete c;
is completely legal as _c_ is an array of chars. the "delete [] XXX" is
intended for arrays of objects to enforce calling the destructors of the
array elements.
Regards,
Marin
"Knowledge is not a crime. Some of its applications are..."
- Unknown hacker