Revision as of 09:25, 20 July 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Created: vin2ktalks (20 Mar 2007)
Last edited: hamishwillee (20 Jul 2012)

Destructor usually deletes any extra resources allocated by the object.

Note, in Symbian C++:

  • 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.

This page was last modified on 20 July 2012, at 09:25.
56 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.