Consider the following C++ sample main.cpp
file:
class FooIf
{
public:
virtual int handle(char *req, char *res) = 0;
};
class BarIf
{
public:
virtual void handle(char *msg) = 0;
};
class Bar : private BarIf
{
private:
void handle(char * msg){}
};
class Zoo : public FooIf, public Bar
{
public:
using FooIf::handle;
public:
int handle(char *req, char *res){ return (0); }
};
int main(){
Zoo zoo;
return (0);
}
I'm getting this warning :
$ clang++ -ggdb -c main.cpp -Wall
main.cpp:23:6: warning: 'Zoo::handle' hides overloaded virtual function [-Woverloaded-virtual]
int handle(char *req, char *res){ return (0); }
^
main.cpp:17:7: note: hidden overloaded virtual function 'Bar::handle' declared here: different number of parameters (1 vs 2)
void handle(char * msg){}
^
Now .. I'm indeed hiding Bar::handle
and I'm doing it on purpose.
Is there a way to avoid suppressing the warning while getting this around?
It is unnecessary to say that g++
does not complain at all about this.