Hello,
I have issues relative to the rule cpp:S1242 I don’t understand.
Here is a minimal code sample I’ve tested with the issues appearing on the lines as indicated in the comments :
class A
{
public:
A();
virtual ~A();
virtual void method1() const;
virtual void method2() const;
virtual void method3(int n) const;
};
A::A() {}
A::~A() {}
void A::method1() const { printf("A::method1\n"); };
void A::method2() const { printf("A::method2\n"); };
void A::method3(int n) const { printf("A::method3 with %d\n", n); };
class B : public A
{
public:
B();
virtual ~B();
virtual void method1() const override; // Correct this function so that it no longer hides "A::method1"
void method2() const override; // Correct this function so that it no longer hides "A::method2"
void method3(int n) const override; // Correct this function so that it no longer hides "A::method3"
};
B::B() {}
B::~B() {}
void B::method1() const { printf("B::method1\n"); };
void B::method2() const { printf("B::method2\n"); };
void B::method3(int n) const { printf("B::method3 with %d\n", n); };
I don’t understand how these issues may appear since override is used for the three virtual methods.
Did I missed something ?
Developer Edition Version 8.0 (build 29455)
Code Analyzer for C, C++, Objective-C : SonarCFamily 6.4 (build 11646)