Take FREE!! Online Cocubes Mock Test to Crack various Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
Take 30+ FREE!! Online Arithmetic Aptitude Mock test to crack any Exams.
Technical Discussion :: C++

78 / 184

Difference between constructor and destructor?

Answer:

Constructor:

1. The constructor is a ‘special’ member function whose task is to initialize the objects of its class.
2. It constructs the values of data members of the class

Destructor:
1. The destructor is a member function whose name is the same as the class name but is preceded by a tilde.
2. It destroys the objects that have been created by a constructor.

Asked In ::

Post Your Answer Here:


Rate This: +1 -0      +
Report    

Post Your Reply Here:

Alert me
q4i-reply-your-answer

Report Error

Please Login First Click Here

Most Popular Qs.