• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: virtual method hidden
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: virtual method hidden


  • Subject: Re: virtual method hidden
  • From: "Sean McBride" <email@hidden>
  • Date: Fri, 9 Dec 2005 11:08:28 -0500
  • Organization: Rogue Research

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

  • Follow-Ups:
    • Re: virtual method hidden
      • From: "Andy O'Meara" <email@hidden>
References: 
 >RE: virtual method hidden (From: "David McCarthy" <email@hidden>)

  • Prev by Date: Re: Cannot link project checkedout from an SVN repository
  • Next by Date: Re: virtual method hidden
  • Previous by thread: Re: virtual method hidden
  • Next by thread: Re: virtual method hidden
  • Index(es):
    • Date
    • Thread