What this C++ destructor design question tests
This is a straightforward question about modern C++ best practices for base class destructors. It targets the kind of language-knowledge depth that firms expect from candidates claiming solid C++ experience, especially those working on financial systems or performance-critical codebases where memory management is non-negotiable.
The question draws on guidance from Herb Sutter, a leading C++ standards expert, and probes whether you understand the trade-offs and correctness principles that govern how destructors should be declared in inheritance hierarchies. Getting this right is essential for writing robust polymorphic code and avoiding subtle bugs.
- Virtual versus non-virtual destructors
- Access qualifiers and their role in preventing misuse
- Polymorphic type design and resource cleanup