Main Content
AUTOSAR C++14 Rule M10-1-1
Classes should not be derived from virtual bases
Description
Rule Definition
Classes should not be derived from virtual bases.
Rationale
The use of virtual bases can lead to many confusing behaviors.
For instance, in an inheritance hierarchy involving a virtual base, the most derived class calls the constructor of the virtual base. Intermediate calls to the virtual base constructor are ignored.
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: Advisory, Automated |
Version History
Introduced in R2019a