RE: virtual method hidden
RE: virtual method hidden
- Subject: RE: virtual method hidden
- From: "David McCarthy" <email@hidden>
- Date: Mon, 12 Dec 2005 11:31:57 -0500
- Thread-topic: virtual method hidden
Hmm, neither can I. Maybe this broke in CW9. But the C/C++ Warnings panel has a checkbox for Hidden Virtual Functions, and I think there was a pragma for it also.
-----Original Message-----
From: Sean McBride [mailto:email@hidden]
Sent: Friday, December 09, 2005 11:08 AM
To: David McCarthy; Steve Mills; email@hidden
Subject: Re: virtual method hidden
On 2005-12-08 17:03, David McCarthy said:
>I'm sure that CW would also warn about it; that's where I first learned
>about the concept.
I can't get CW to warn about it. Here is my test code:
class Base
{
public:
virtual void Method (void* param);
virtual void Method (int param, int param);
};
class Derived : public Base
{
public:
virtual void Method (void* param);
};
int main (int argc, char * const argv[])
{
Derived obj;
obj.Method (0);
return 0;
}
With Xcode 2.2/gcc 4.0.1 this warns:
warning: 'virtual void Base::Method(int, int)' was hidden
warning: by 'virtual void Derived::Method(void*)'
With CodeWarrior 10, it doesn't even compile:
Error : identifier 'param' redeclared
main.cpp line 5 virtual void Method (int param, int param);
Fix that little typo to param1, param2... (off to radar for that....)
then it compiles but with no warnings. I have every warning enabled in
the C/C++ Warnings panel. How did you get the warning in CW?
IMNSHO, this little example proves to me once again how valuable it is
to have several compilers.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
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