deleting an object

Posted by Nima on Stack Overflow See other posts from Stack Overflow or by Nima
Published on 2010-06-03T18:19:00Z Indexed on 2010/06/03 18:24 UTC
Read the original article Hit count: 365

Filed under:
|
|

Hi,

First, when you want to free the memory assigned to an object in C++, which one is preferred? Explicitly calling deconstructor or using delete?

Object* object = new Object(...);
...

delete object;

OR

object->~Object();

Second, does the delete operator call the deconstructor implicitly?

Thanks,

© Stack Overflow or respective owner

Related posts about c++

Related posts about delete