Difficulty: Easy
Correct Answer: no
Explanation:
Introduction / Context:
Destructors release resources and perform cleanup when an object’s lifetime ends. Understanding their signature is essential for writing correct RAII classes (Resource Acquisition Is Initialization) in C++. This question asks about the parameter list for a destructor.
Given Data / Assumptions:
Concept / Approach:
By definition, a destructor cannot take parameters and cannot return a value. Its spelling includes an empty parameter list. You also cannot overload a destructor; each class has exactly one destructor (which may be implicitly generated, defaulted, deleted, or user-defined). Therefore, the correct completion is that a destructor takes “no” arguments.
Step-by-Step Solution:
Verification / Alternative check:
Attempting to declare ~ClassName(int); fails to compile. Only special cases like virtual destructors change dispatch, not the parameter list.
Why Other Options Are Wrong:
one/two/three — contradict the C++ grammar for destructors.
Common Pitfalls:
Final Answer:
no
Discussion & Comments