| title | C26443 | |
|---|---|---|
| keywords | C26443 | |
| ms.date | 01/18/2017 | |
| ms.topic | reference | |
| f1_keywords |
|
|
| helpviewer_keywords |
|
|
| dev_langs |
|
|
| description | Rule concerning overriding destructors |
"Overriding destructor should not use explicit 'override' or 'virtual' specifiers."
This warning was removed as of Visual Studio 16.8 Preview 4 to reflect changes to C.128 in the C++ Core Guidelines.
C.128: Virtual functions should specify exactly one of virtual, override, or final.
The current consensus on the Core Guidelines is to exclude destructors from the 'override explicitly' recommendation.
- The rule flags overriding destructors that explicitly use 'virtual' or 'override' specifiers.
- Destructors can still use the 'final' specifier because of its special semantics.
- Warnings show up on function definitions, not declarations. It may be confusing, since definitions don't have virtual specifiers, but the warning is still appropriate.
class Transaction {
public:
virtual ~Transaction();
// ...
};
class DistributedTransaction : public Transaction {
public:
~DistributedTransaction() override { // C26443
// ...
}
};C.128: Virtual functions should specify exactly one of virtual, override, or final