According to the Rule of Three, a class that needs a user-defined destructor usually also needs which two special members?
Correct answer D. A copy constructor and a copy assignment operator
Explanation
A user-defined destructor usually means the class manages a resource, such as raw memory or a file handle. The compiler-generated copy constructor and copy assignment would copy only the handle, leading to double frees or leaks, so those two need custom definitions too. In C++11 the Rule of Five extends this to the move constructor and move assignment operator.
Answer checked How we write and check questions
Discussion