• 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: Hidden Virtual Functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hidden Virtual Functions


  • Subject: Re: Hidden Virtual Functions
  • From: Clark Cox <email@hidden>
  • Date: Thu, 26 May 2005 09:32:36 -0400

On 5/23/05, William Rector <email@hidden> wrote:
> I'm using Xcode 2.0 OS X 10.4.1 and moving several C++ projects from CW 9.5
> to Xcode.
>
>
> I am getting a bunch of warnings of hidden virtual functions and am
> wondering if Xcode is really unabled to match the right virtual function or
> the message is bogus.
> I have a base class with the following:
> virtual    SInt32        ProcessKeyword(char* szKey,char* szParams);
> virtual    SInt32        ProcessKeyword(UInt32 nKeyCode,char* szParams);
> I keep getting 'warning: 'virtual SInt32
> CTFReader::ProcessKeyword(char*,char*) was hidden.
> I guess I will find out soon when I get past my libraries to one of my
> applications.

I am assuming that you have something like:

class Base
{
virtual    SInt32        ProcessKeyword(char* szKey,char* szParams);
virtual    SInt32        ProcessKeyword(UInt32 nKeyCode,char* szParams);
};

class Derived : Base
{
//Only overloading one of them
virtual    SInt32        ProcessKeyword(char* szKey,char* szParams);
};

If this is so, then the warning is correct, and it is an error if you
do something like:
    Derived d;
    d.ProcessKeyword(25,"asdf");

But this is still OK:
    Base *b = new Derrived;
    b->ProcessKeyword(25,"asdf");

You can fix this by either:
1) Adding "using Base::ProcessKeyword;" like so:
class Derived : Base
{
using Base::ProcessKeyword;
virtual    SInt32        ProcessKeyword(char* szKey,char* szParams);
};
2) or making sure that you implement all overloads of ProcessKeyword
in the derrived class.

--
Clark S. Cox III
email@hidden
http://www.livejournal.com/users/clarkcox3/
http://homepage.mac.com/clarkcox3/
 _______________________________________________
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

References: 
 >Hidden Virtual Functions (From: William Rector <email@hidden>)

  • Prev by Date: Re: How to work around this bug?
  • Next by Date: Re: Xcode-users Digest, Vol 2, Issue 224
  • Previous by thread: Hidden Virtual Functions
  • Next by thread: PackageMaker 2 Installer doesn't overwrite files.
  • Index(es):
    • Date
    • Thread