Suppose the code below:
Base.h
template <class T>
class Base
{
public:
virtual void func(T value) {}
};
Derived.h
class Derived : public Base<Type1>
, public Base<Type2>
{
public:
void func(Type1 object) override {}
};
Basically I have a templated class with a member function that takes the argument of the template type. The derived class derive from the base with two different class type, and override the function of one of them.
With the Clang compiler, it would generate a hides overloaded virtual functions
warning, which is actually intended here, i.e. I do not need Base2::func(float)
in the derived class.
I am aware that by appending -Wno-overloaded-virtual
to the compiler flags would mute this warning but I'm not sure that's the safe thing to do, as in other cases this warning may be valid.
In my project I have thousands of this case (i.e. many derived classes with different class types). Are there any good suggestion over it so the warning wouldn't be present for this situation but keep it for others?