Partial override of overloaded virtual functions
Class overrides fraction of inherited virtual functions with a given name
Description
This defect occurs when:
A base class has multiple
virtual
methods with the same name but different signatures (overloading).A class derived from the base class overrides at least one of those
virtual
methods, but not all of them.
Risk
The virtual
methods that the derived class
does not override are hidden. You cannot call those methods using
an object of the derived class.
Fix
See if the overloads in the base class are required. If they are needed, possible solutions include:
In your derived class, if you override one
virtual
method, override allvirtual
methods from the base class with the same name as that method.Otherwise, add the line
using
to the derived class declaration. In this way, you can call the base class methods using an object of the derived class.Base_class_name
::method_name
Examples
Result Information
Group: Object oriented |
Language: C++ |
Default: On for handwritten code, off for generated code |
Command-Line Syntax: PARTIAL_OVERRIDE |
Impact: Medium |
Version History
Introduced in R2015b
See Also
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)