Main Content
MISRA C++:2008 Rule 10-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.
Polyspace Implementation
Polyspace® raises a violation if a class is derived from a virtual
base class.
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 |
Version History
Introduced in R2013b