diff --git a/rules/S3471/cfamily/rule.adoc b/rules/S3471/cfamily/rule.adoc index 9d656e73632..3d019e51d35 100644 --- a/rules/S3471/cfamily/rule.adoc +++ b/rules/S3471/cfamily/rule.adoc @@ -1,6 +1,6 @@ == Why is this an issue? -In a base class, ``++virtual++`` indicates that a function can be overridden. In a derived class, it indicates an override. But given the specifier's dual meaning, it would be both clearer and more sound to use derived class-specific specifiers instead: ``++override++`` or ``++final++``. +In a base class, ``++virtual++`` indicates that a function can be overridden. In a derived class, it indicates an override. But given the specifier's dual meaning, it would be clearer and more sound to use derived class-specific specifiers instead: ``++override++`` or ``++final++``. [source,cpp] ---- @@ -12,7 +12,10 @@ public: c++; } }; +---- +[source,cpp,diff-id=1,diff-type=noncompliant] +---- class FastCounter: public Counter { public: virtual void count() { // Noncompliant: ambiguous @@ -24,7 +27,7 @@ public: * ``++override++`` indicates that a function is intended to override a base-class function. The compiler will issue a warning if this is not the case. -[source,cpp] +[source,cpp,diff-id=1,diff-type=compliant] ---- class FastCounter: public Counter { public: @@ -36,7 +39,7 @@ public: * ``++final++`` indicates a function ``++override++`` that cannot itself be overridden. The compiler will issue a warning if the signature does not match the signature of a base-class ``++virtual++`` function. `override` is redundant when `final` is specified. -[source,cpp] +[source,cpp,diff-id=1,diff-type=compliant] ---- class FastCounter: public Counter { public: @@ -86,7 +89,7 @@ specifier to be dropped \[~evgeny.mandrikov] given the fact that it's only a compiler warning to have a ``++virtual++`` function in a derived class with a mismatched signature, do we want a rule on that? -E.G. +E.G. ---- class BaseClass