Re: Objects return nil
Re: Objects return nil
- Subject: Re: Objects return nil
- From: Tom Sutcliffe <email@hidden>
- Date: Fri, 8 Aug 2003 02:28:57 +0100
On Thursday, August 7, 2003, at 02:09 pm, Michael Hanna wrote:
lineArray = [[NSMutableArray alloc] initWithArray:[lines
tokenLines]];
Also, the NSArray returned is retrieved as an NSMutableArray. Is
explicit casting necessary?
since initWithArray is defined by NSArray and only needs an array, this
is fine. You rarely need to cast in Obj-C. This could however be more
concisely expressed as
lineArray = [[lines tokenLines] mutableCopy]
In fact I've always wondered why NSArray even has the initWithArray
method given the presence of the copy and mutableCopy methods.
Regards,
Tom
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.