pickzy.com

C  |  C++  |  Objective-C  |  VC++  |  Win32  |  MFC  |  Java  |  Php  |  Delphi  |  Visual Basic  |  .Net  |  Networking  |  General  |  Games  |  Jobs  |  Javascript  |  




Menu

pickSourcecode.com


        

 




 

Cpp > Articles

 

Cpp - c++ Destructors

Destructors are usually used to deallocate memory and do other cleanup 
for a class object and its class members when the object is destroyed. 
A destructor is called 
for a class object when that object passes out of scope or 
is explicitly deleted.

A destructor is a member function with the same name as its class 
prefixed by a ~ (tilde). For example:

class X {
public:
  
//  Constructor  for  class  X
  X();

  
//  Destructor  for  class  X
  ~X();

};


 
Privacy Policy | About Us