Re: Convenience Methods
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