MISRA C++:2008 Rule 10-2-1
All accessible entity names within a multiple inheritance hierarchy should be unique
Description
Rule Definition
All accessible entity names within a multiple inheritance hierarchy should be unique.
Rationale
Data members and nonvirtual functions within the same inheritance hierarchy that have the same name might cause developer confusion. The entity the developer intended for use might not be the entity the compiler chooses. Avoid using nonunique names for accessible entities within a multiple inheritance hierarchy.
Polyspace Implementation
This checker flags entities from separate classes that belong to the same derived class if they have an ambiguous name. The name of an entity is ambiguous if:
Two variables share the same name, even if they are of different types.
Two functions share the same name, same parameters, and the same return type.
If the data member accessed in the derived class is ambiguous, Polyspace® reports this issue as a compilation issue, not a coding rule violation. The checker does not check for conflicts between entities of different kinds such as member functions against data members.
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