hits counter
  Create Free Blog | Random Blog »   Report Abuse | Login   

 

Constructor and destructor functions


Tags: , ,

Constructor

Constructor is a special type member function,which execute automatically whenever an object is created.

Rules of creating Constructor:

*Name              :Constructor name is same as class name.

*Scope              :Public

*Return Type    :Nil

*Argument       :Optional

*Overloading   :Possible

Use:

*Variable Initialization

*Resource Allocation

*Type Conversion

Destructor

Destructor is a special type member function,which execute automatically whenever an object is destroyed.

Rules for creating Destructor:

*Name             :Destructor name is same as class name with prefix a tilled(~) character

*Scope             :public

*Return Type   :Nil

*Argument       :Not Possible

*Overloading   :Not Possible

Use

*Resource (Memory) Deallocation.

*Cleanup process

Share SocialTwist Tell-a-Friend 
Generated Keywords for the page : operator overloading , function , c , operator , pointer , functions , , c tutorial , learning c , function prototype , c script , no match for operator , pointers to structures , c null pointer , c sort , c type void , double pointer , friend operator , friend ostream operator , newboynudes , null pointer , object c , pointers and structures , structs c , template operator , this pointer , vector of pointers , virtual operator , void c , void function , what is a pointer , array of function pointer , array of function pointers , c function prototype , c language pdf , c struct constructor , c type , const pointer , cpp delete , declaration of operator as non function , delphi class function , friend function , friend function example , friend functions , function pointer array , function template , learn cpp , learning cpp , null c , objective c pdf , objective c reference , operator cpp , static function , static functions , static member function , static member functions , struct c , struct c function ,

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image