AUTOSAR C++14 Rule M10-3-3
A virtual function shall only be overridden by a pure virtual function if it is itself declared as pure virtual
Description
Rule Definition
A virtual function shall only be overridden by a pure virtual function if it is itself declared as pure virtual.
Rationale
In C++, an abstract class is the base of a polymorphic class hierarchy and the derived classes implement variation of the abstract class. When a virtual function is overridden in a derived class by a pure virtual function, the derived class becomes an abstract class. That a derived class is defined as an abstract class or an implemented function is overridden by a pure virtual function is unexpected behavior, which might confuse a developer.
Polyspace Implementation
Polyspace® flags a pure virtual function if it overrides a function that is not pure virtual.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Derived Classes |
Category: Required, Automated |
Version History
Introduced in R2019a