Re: Disabling warnings
Re: Disabling warnings
- Subject: Re: Disabling warnings
- From: "Andy O'Meara" <email@hidden>
- Date: Thu, 07 Jul 2005 11:29:01 -0400
>
> Finally, has anyone noticed that the hidden virtual function warnings
> are a bit buggy (or maybe my understanding is wrong)? The following
> code generates warnings, I don't think it should:
>
> class A
> {
> public:
>
> virtual void F();
> virtual void F( int i );
> };
>
> class B : public A
> {
> public:
>
> virtual void F();
> };
>
> This will generate these warnings:
>
> warning: 'virtual void A::F(int)' was hidden
> warning: by 'virtual void B::F()'
>
> This does not look right to me - B::F() does not hide A::F(int)!
>
No, this is correct/consistent behavior. Actually, CodeWarrior's compiler
behaves the same way (but it doesn't generate warning for this particular
scenario--you only see 'hide' warnings when none of the methods have a
matching prototype). If you compiled the following on CodeWarrior, you'd
get an error:
{
B blah;
blah.F( 123 ); // Error: F( int ) does not match F( void )
blah.A::F( 123 ); // No error
}
Your child classes need to have methods for other overloaded methods (if you
wish to use them). Kind of bummer, but this appears to be the
standard--anyone know the basis?
Andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden