What is one level copy in objective c?.
Well obviously i'm new to this language, stumbled upon this doubt which i hope it will get cleared here
.
Reffering http://developer.apple.com/library/m...s/Copying.html.
Under title : "Copying and Mutability"
I'm unable to understand what is meant here by deeper levels, or surface levels of copying. can anyone explain ?...
Thanks in advance
.

Reffering http://developer.apple.com/library/m...s/Copying.html.
Under title : "Copying and Mutability"
I'm unable to understand what is meant here by deeper levels, or surface levels of copying. can anyone explain ?...
Thanks in advance

Comments
Shallow copy only gives you a unique copy of pointers to data
Deep copy gives you unique pointers and unique second-level data but deeper levels not immutable
True deep copy is entirely unique even for arrays of arrays and requires an archive/unarchive process:
NSArray* trueDeepCopyArray = [NSKeyedUnarchiver unarchiveObjectWithData:
[NSKeyedArchiver archivedDataWithRootObject: oldArray]];
In the following: [item1:"Tim", item2:37, item3:[job:"CEO", salary:"$1"]]
Surface would be identifiers item1 etc, level 2 would be Tim and 37. Deeper levels would be the contents of item3.
You just need to make sure that when you make a copy of a complex data set that it's unique when you need it to be, by using the right copying function to prevent modifications to the copied set affecting the original or vice versa. The same is true in most languages but recursive deep copy can create a recursive loop if there are references to the object itself so having different levels of copying makes some sense.
Your best bet would be to experiment with a data set containing arrays of arrays, run the various copy types and see what effect changes to the copy has on both sets.