Which among the following is correct for the destructors concept?

Which among the following is correct for the destructors concept?
A. Destructors can be overloaded
B. Destructors can have only one parameter at maximum
C. Destructors are always called after object goes out of scope
D. There can be only one destructor in a class
 
Answer: d
Explanation: This is so because the destructors can’t be overloaded. And the destructor must have the same name as that of class with a tilde symbol preceding the name of the destructor. Hence there can be only one destructor in a class. Since more than one function with same name and signature can’t be present in same scope.
 

Tìm kiếm

Back
Top