Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 21:13, 13 December 2007.

Delete

From Forum Nokia Wiki

delete Operator

The delete operator destroys the object created with new by deallocating the memory associated with the object.

The operand of delete must be a pointer returned by new, and cannot be a pointer to constant. Deleting a null pointer has no effect.

The delete[] operator frees storage allocated for array objects created with new[]. The delete operator frees storage allocated for individual objects created with new.

The result of deleting an array object with delete is undefined, as is deleting an individual object with delete[]. The array dimensions do not need to be specified with delete[].

The result of any attempt to access a deleted object or array is undefined.

If a destructor has been defined for a class, delete invokes that destructor. Whether a destructor exists or not, delete frees the storage pointed to by calling the function operator delete() of the class if one exists.

The global ::operator delete() is used if:

* The class has no operator delete().
* The object is of a nonclass type.
* The object is deleted with the ::delete expression. 

The global ::operator delete[]() is used if:

* The class has no operator delete[]()
* The object is of a nonclass type
* The object is deleted with the ::delete[] expression. 

The default global operator delete() only frees storage allocated by the default global operator new(). The default global operator delete[]() only frees storage allocated for arrays by the default global operator new[]().

Related Discussions
Thread Thread Starter Forum Replies Last Post
Self destruction in AO truf General Symbian C++ 6 2007-08-17 05:01
Problem with linking implrment dialog class TheChups General Symbian C++ 6 2007-03-17 18:20
How i can know that user delete the message?? Tanya Symbian Networking & Messaging 3 2007-06-22 10:25
Carbide.ui troubles! sunshine74 Themes/Carbide.ui 7 2007-02-04 16:58
JSR75 - Delete File, no "real" Exception MGvision Mobile Java General 9 2007-06-26 06:51
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX