Re: style question: when to use 'id' as return value?
Re: style question: when to use 'id' as return value?
- Subject: Re: style question: when to use 'id' as return value?
- From: Chris Suter <email@hidden>
- Date: Tue, 18 Dec 2007 09:24:10 +1100
On 18/12/2007, at 9:14 AM, Sean McBride wrote:
Hi all,
NSString has the method:
+ (id)stringWithString:(NSString *)aString
Why is the return value not an 'NSString*' instead of an 'id'? Is
this
just a stylistic preference, or...?
Thanks,
It believe it's to do with the fact that it returns an NSMutableString
for NSMutableString. If it was just NSString you'd get a compiler
warning for this:
NSMutableString *s = [NSMutableString stringWithString:@"MyString"];
- 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