|
![](/i/fill.gif) |
Am 13.03.2012 20:41, schrieb Orchid Win7 v1:
> (I'm also fuzzy on what happens when
> you try to delete a pointer - does it know what the "real" size of the
> object is, or does it use the declared type of the pointer?)
Just like free() in C, the delete operator in C++ frees whatever memory
was originally allocated to the object, so you don't need to worry about
/that/.
What you /should/ worry about, however, is which destructor will be
called: Make sure to equip all of your virtual classes with a virtual
destructor, otherwise the C++ standard guarantees for nothing.
(For non-virtual classes it is good practice to define a protected
non-virtual destructor instead, just to be sure.)
Post a reply to this message
|
![](/i/fill.gif) |