Mail Archives: djgpp/2000/08/17/11:45:29
"Rafał Maj" <r_maj AT poczta DOT onet DOT pl> wrote:
>What is difference between delete and delete[] ?
>With one should I use to delete array : char *ptr = new char[1024] ?
>When I'm overloading operator delete for some class, should I overload
>operator delete[] too ?
>
>
>
If you are using new to create an Array, you have to use
delete[]. That means, when you use new with [] (like in
your example), you have to use delete [].
Overloading operator delete is rarely necessary. Only with
very special classes that get a special memory region from
their own operator new, is it necessary to provide an
overloaded form of delete. I wouldn't worry about that. No
offense, but someone, who is just learning how to use
delete, should not try to overload delete.
--
Manni
"Life would be much easier if I had the source code."
- Raw text -