C++ Programming - Constructors and Destructors - Discussion

Discussion Forum : Constructors and Destructors - General Questions (Q.No. 14)
14.
Which of the following statement is correct?
Destructor destroys only integer data members of the object.
Destructor destroys only float data members of the object.
Destructor destroys only pointer data members of the object.
Destructor destroys the complete object.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
6 comments Page 1 of 1.

Umakant said:   1 decade ago
We all know that destructor is called at the end of the object, i.e. when the mF goes out of the class then destructor called becuse of to delete the object. So conclusion is come that Destructor destroy the complete object.

Zal.kazachstan said:   1 decade ago
Destructor doesn't destroy the complete object! It's called when the object is destroyed.

But when using destructor i.e. object class() you still have object. So it doesn't destroy them.

Vashisht said:   1 decade ago
What is constructor and destructor explain it?

Ananthavelan said:   6 years ago
Thank you for explaining.

Prakas.s said:   4 years ago
@Vashisht.

Constructor means the Class created (a constructor is a "special" member function and also called as the "Automatically" and the initialized the objects of the class) and Destructor means to destroy the objects that the is created by the constructor.

Charuka said:   2 years ago
The constructor creates by the same name as the class name and the destructor creates to get rid of the constructor.

Post your comments here:

Your comments will be displayed after verification.