C++ Programming - Constructors and Destructors - Discussion

Discussion Forum : Constructors and Destructors - General Questions (Q.No. 39)
39.
Which of the following statement is correct whenever an object goes out of scope?
The default constructor of the object is called.
The parameterized destructor is called.
The default destructor of the object is called.
None of the above.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
3 comments Page 1 of 1.

Purusoth said:   1 month ago
Constructor : "birth" of the object.
Destructor : "death" of the object.

When an object goes out of scope, its destructor is called automatically.
If you don't provide a destructor, the default destructor (automatically generated by the compiler).
There is no such thing as a "parameterised destructor" in C++.
The constructor (default or parameterised) is called when the object is created, not when it goes out of scope.

Jindgi said:   8 years ago
Please explain its another way.

Hoy_smallfry said:   1 decade ago
Default destructor is misleading because there is only one function signature for a destructor.

Post your comments here:

Your comments will be displayed after verification.