135k views
5 votes
The destructor automatically executes when the class object goes out of ____.

a. scope
b. use
c. a and b
d. None of the above

User Aravind S
by
7.6k points

1 Answer

5 votes

Answer: Scope

Explanation: Destructor is the function which is used to delete or erase the object. This function gets invoked automatically when the object of the class goes out of scope. It gets invoked in situation like when a delete operation is to be performed or when program or function ends etc. Destructor is preceded with sign "~"(tilde) before before the declaration and it does not return any value.

User Thetont
by
8.7k points