MISRA C++:2008 Rule 10-3-1
There shall be no more than one definition of each virtual function on each path through the inheritance hierarchy
描述
规则定义
There shall be no more than one definition of each virtual function on each path through the inheritance hierarchy. 1
理由
检查项对在继承层次结构中同一路径上具有多个定义的虚拟成员函数进行标记。如果一个函数被多次定义,则在给定函数调用中使用的是哪个实现可能会出现歧义。
Polyspace 实现
如果在派生类中重新定义了基类成员函数,但未使用关键字 virtual
,检查项也会引发违规。
故障排除
如果您预期会出现违规,而 Polyspace® 未报告该违规,请参阅诊断为何编码规范违规未按预期显示。
示例
检查信息
组:派生类 |
类别:必需 |
版本历史记录
在 R2013b 中推出
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace Bug Finder™ documentation are from the following MISRA standards:
MISRA C:2004
MISRA C:2012
MISRA C:2023
MISRA C++:2008
MISRA C++:2023
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.