Re: NSDate Question
Re: NSDate Question
- Subject: Re: NSDate Question
- From: "Sean McBride" <email@hidden>
- Date: Fri, 8 Dec 2006 12:26:09 -0500
- Organization: Rogue Research
On 2006-12-08 09:19, Roland Torres said:
>> - (void)setMyDate:(NSDate *)aMyDate
>> {
>> if (myDate != aMyDate) {
>> [myDate release];
>> myDate = [aMyDate copy];
>> }
>> }
>
>Noob question here.
>Is doing:
> myDate = [aMyDate copy];
>preferable to doing:
> myDate = [aMyDate retain];
This could become a long discussion... You might want to google
'accessor patterns'.
But ask yourself: "Do I want the value, or the actual object?" For the
former use 'copy' for the latter use 'retain'. I would think with a
date, it's the value that's more interesting.
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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