PDA

View Full Version : destroying object...



mind_freak
22nd July 2009, 17:32
hi
how to destroy the object...created during the execution of program to handle memory managment..

thanks in advance

spirit
22nd July 2009, 17:56
using operator delete.

mind_freak
22nd July 2009, 18:26
hi
can i have to use delete operator in destructor only or anywhere in the program code..

faldzip
22nd July 2009, 18:49
you can use delete anywhere, but only on objects created on heap (with operator new). And delete calls the destructor so you can use delete on other member variables (created on a heap) of that object to clean up.

P.S. There are a lot of C++ tutorials in the Internet so please take a look at them - you ask about C++ basics needed to start writing more advanced applications than "Hello World!"