-Woverloaded-virtual flag
Schumacher, Gordon
gordon_schumacher@maxtor.com
Wed Aug 7 13:49:00 GMT 2002
So... I'm getting warnings generated from the following code:
class A
{
virtual A* foo()
{var++; return this;}
virtual A* foo(int16 idx)
{return NULL;}
};
class B: public A
{
virtual A* foo(int16 idx)
{return new B(base + idx);}
}
Warning: `virtual A* A::foo()' hidden
Warning: by `virtual A* B::foo(short int)'
If my understanding is correct, this should not be a warning at all - both
forms of this function are defined in the parent class, so the base function
should not be hidden!
Am I confused on this? I've also tried it without the "virtual" on class
B's function declaration.
Thanks!
More information about the Gcc-bugs
mailing list