• 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: Convenience Methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convenience Methods


  • Subject: Re: Convenience Methods
  • From: Chris Suter <email@hidden>
  • Date: Wed, 26 Sep 2007 12:47:33 +1000


On 26/09/2007, at 11:46 AM, Jeff Laing wrote:

There is no way the class method is going to return subclasses.

Yes there is.

If you call [MySubclass repoWithName:…] you'd get an instance of MySubclass. You don't need to override the class method for it to do this.

And with regards to the original question, you shouldn't use "id" as the return type. The class cluster issue mentioned in other posts is confusing the issue. NSString methods are declared as returning NSString * not id. This is because you want the compiler to know as much about the type as possible i.e. that the object returned conforms to all the methods declared by NSString. The fact that it's a different class underlying this doesn't matter — the object returned conforms to NSString.

- Chris

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >RE: Convenience Methods (From: Jeff Laing <email@hidden>)

  • Prev by Date: Re: Convenience Methods
  • Next by Date: RE: Convenience Methods
  • Previous by thread: Re: Convenience Methods
  • Next by thread: RE: Convenience Methods
  • Index(es):
    • Date
    • Thread