• 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: Methods with the same name but different return types
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Methods with the same name but different return types


  • Subject: Re: Methods with the same name but different return types
  • From: Bill Bumgarner <email@hidden>
  • Date: Fri, 03 Jun 2011 10:44:36 -0700


On Jun 3, 2011, at 8:15 AM, Jens Alfke wrote:

The drawback is that, in this case, the compiler can’t figure out which version of the ‘overloaded’ selector is meant, which can cause trouble. That’s why you want that compiler warning on. But the warning has nothing to do with arrays; this can happen anyplace where an ‘id’ type is messaged.

What Jens said. 

The best solution is to rename your method to avoid the collision.

The second best solution is to make sure that you explicitly typecast everywhere. 

IIRC the compiler should warn if it sees two method declarations with incompatible types and it can't resolve which one to use in the context of the call. 

b.bum
 _______________________________________________
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: Methods with the same name but different return types
      • From: Andreas Grosam <email@hidden>
References: 
 >Re: Methods with the same name but different return types (From: Tony Romano <email@hidden>)
 >Re: Methods with the same name but different return types (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Methods with the same name but different return types
  • Next by Date: Unable to build 'Fun House' example due to mysterious SDK...
  • Previous by thread: Re: Methods with the same name but different return types
  • Next by thread: Re: Methods with the same name but different return types
  • Index(es):
    • Date
    • Thread