Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

warning w8022 ...hides virtual function...

Status
Not open for further replies.

wouterlammers

Programmer
Apr 17, 2008
1
ES
Hello,

With this piece of code the c++ builder compiler correctly emits the warning:
[BCC32 Warning] Unit1.cpp(23): W8022 'Derived::Overload(float)' hides virtual function 'Base::Overload(int)'

code:
Code:
struct Base
{
   virtual void Overload(int) { Form1->Memo1->Lines->Add("Base::int"); }
};

struct Derived: Base
{
   virtual void Overload(float) { Form1->Memo1->Lines->Add("Derived::float"); }
};


My problem is that if I include 'using Base::Overload;' into the declaration of the derived class the warning does not go away. Even though the base function is correctly pulled into overload resolution for Derived. Is this a c++ builder quirk? I have been using c++ builder 6.0 and now am using codegear c++ builder 2007, both have this issue.
 
I'm going to hazard a guess here but I would say that this is a Borland/CodeGear quirk. Somewhere I've read that how compilers handle situations like this is up to the compiler implementation. Different compilers may handle this situation differently.

Note that this is a warning and not an error. It may work the way you expect it to but then again . . .



James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top