You Are Here:

Community: Wiki

This page was last modified on 17 March 2009, at 21:26.

Destructor

From Forum Nokia Wiki

Destructor usually deletes any extra resources allocated by the object.

Note:

  • Destructor can NOT be allowed to leave! A leave from a destructor may cause the program to terminate abruptly. In S60 3rd edition and later releases a leave is an exception and there can be only one active exception at a time. The destructor may have been called as a part of a routine to handle an exception (leave) and raising another exception will cause the program to be terminated.
  • Always delete objects your class owns, from the class destructor.
  • Don’t delete objects that you don’t own (those that you merely use).
  • Don’t allocate twice (this will cause a memory leak).
  • Don’t delete twice (this will corrupt the heap).
  • When you delete outside of the destructor, immediately set the pointer to zero.
  • When you are reallocating, you must use the sequence ‘delete, set pointer to zero, allocate’, just in case the allocation fails.

See also delete.

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia