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: Denis Stanton <email@hidden>
- Date: Wed, 12 Feb 2003 10:50:34 +1300
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.