If a base class destructor is declared virtual, one should avoid declaring derived class destructors virtual or override.
Why is this?
Using override on a derived class destructor provides protection against the base class destructor accidentally being made non-virtual, thus introducing subtle, hard to detect and hard to diagnose memory leaks. @
Okay, so based on that thread, the only real reason is that it's unusual because destructors aren't really inherited - an implementation detail. As far as I can tell, doing so has absolutely zero practical negative implications.. and a very useful positive impact. So my question still stands, really.
What annoys me the most is that it is an absolutely needless exception to an otherwise straightforward rule: "Virtual functions should be marked with exactly one of virtual, override or final".
C++ guidelines already have far too many exceptions (most of the time for good reason) - we don't have to artificially complicate them further.
Most helpful comment
What annoys me the most is that it is an absolutely needless exception to an otherwise straightforward rule: "Virtual functions should be marked with exactly one of virtual, override or final".
C++ guidelines already have far too many exceptions (most of the time for good reason) - we don't have to artificially complicate them further.