• 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: Jim Correia <email@hidden>
  • Date: Tue, 25 Sep 2007 22:29:07 -0400

On Sep 25, 2007, at 10:10 PM, Jeff Laing wrote:

NSString's convenience methods are hiding class clusters, and I stand by the
assertion that every one of them returns a valid NSString object. They may
be subclasses of NSString but that does not make them non-NSString objects.
Inheritance 101.

But you are still missing the point of why you'd want it to be declared to return id. Even though an NSMutableString is an NSString, you want to be able to write


NSMutableString *string = [NSMutableString stringWithXXX: ...];

If the method were declared to return NSString *, the compiler would warn you about an assignment from a distinct Objective-C type.

Jim
_______________________________________________

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: Problems loading data into NSTableView using a NSArrayController
  • Next by Date: Re: Qustion about possibly bad advice in NSView documentation
  • Previous by thread: Re: Convenience Methods
  • Next by thread: RE: Convenience Methods
  • Index(es):
    • Date
    • Thread