• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: help needed with OO concepts when copying
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >RE: help needed with OO concepts when copying (From: "Jonathan E. Jackel" <email@hidden>)

  • Prev by Date: RE: how is C often used in Cocoa, if at all?
  • Next by Date: Re: how is C often used in Cocoa, if at all?
  • Previous by thread: RE: help needed with OO concepts when copying
  • Next by thread: Re: help needed with OO concepts when copying
  • Index(es):
    • Date
    • Thread