Introduction

C++ provides two special member functions called constructor and destructor, for automatic initialization and deletion of objects. When the object is created, the constructor enables the object to initialize the data items in it. On the other hand the destructor destroys the object, when it is no longer in use.

In the case of objects, variables with user-defined data types, these tasks, such as automatic initialization and destruction are done by special member functions called constructors and destructors. At the time of creation of an object, the constructor in the object automatically initializes the data members in the object. Destructors are used to destroy those objects created by the constructors. Destructors removes from the memory the work shop occupies by the object, which is no longer required.



Other recommended posts of Constructor and Destructor



Posted by Unknown On 23:51 No comments

0 comments:

Post a Comment

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Blog Archive

Contact Us


Name

E-mail *

Message *