• 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: Function overloading for ObjC classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function overloading for ObjC classes


  • Subject: Re: Function overloading for ObjC classes
  • From: Phillip Hutchings <email@hidden>
  • Date: Sun, 22 Feb 2004 23:05:01 +1300

On 22/02/2004, at 7:23 PM, Allan Odgaard wrote:

> I wanted to write two versions of a function, one for NSData and
> another for NSMutableData. Unfortunately the compiler says that I
> redefine the same function. Example:
> [snip]

From what it looks like, you're overloading two C functions. Check the
extension is .mm, not .m and it should work. Or declare it as id and
check the type in the function.

> I wonder, is this a GCC bug? Overloading does work for "different"
> classes (i.e. non sub/super class relationships).

I guess if it's a C++ function, then it's a GCC bug. C++ should support
it. If it's an Objective C method, they the fact that you can override
like that is a bug.

--
Phillip Hutchings
email@hidden
http://www.sitharus.com/

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Function overloading for ObjC classes (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: adding to my UI - Thanks
  • Next by Date: Weird bug in my code [long]
  • Previous by thread: Re: Function overloading for ObjC classes
  • Next by thread: Re: Function overloading for ObjC classes
  • Index(es):
    • Date
    • Thread