RE: help needed with OO concepts when copying
RE: help needed with OO concepts when copying
- Subject: RE: help needed with OO concepts when copying
- From: "Mondragon, Ian" <email@hidden>
- Date: Tue, 11 Feb 2003 16:57:24 -0600
denis,
just as a side note, the objects returned from a call to -mutableCopy are
implicitly retained, so you're responsible for releasing them <gotcha!>.
- ian
>
-----Original Message-----
>
From: Denis Stanton [SMTP:email@hidden]
>
Sent: Tuesday, February 11, 2003 3:51 PM
>
To: email@hidden
>
Cc: email@hidden
>
Subject: Re: help needed with OO concepts when copying
>
>
Hi Jonathan
>
>
On Wednesday, February 12, 2003, at 10:30 AM, Jonathan E. Jackel wrote:
>
>
> An NSArray contains pointers, not values. When you copy an NSArray (or
>
> NSMutableArray), you copy the pointers. If the pointers are to mutable
>
> objects, and those objects change, the "contents" of both arrays
>
> change.
>
>
I understood that that was what was happening. You've put it into the
>
proper words far better than I did.
>
>
> What you want to do is make a "deep copy" of the array by enumerating
>
> through it and doing mutableCopy on each of its objects, then adding
>
> those
>
> copies to a new array.
>
>
Ah.... Great. that's exactly what I needed. I didn't think of copying
>
the array one "row" at a time.
>
>
Thanks a lot for taking the time to put me straight.
>
>
Denis Stanton
>
_______________________________________________
>
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.
_______________________________________________
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.