In objective C, same to C++ language, if you assign object to object it will get its pointing address like this:
object1 = object2;
So changing in one of objects above will affect the other one.
Is this the same for MutableCopy? and what is the difference between copy and MutableCopy?
How to do deep copy?
In
Objective C
there is different memory management model than inC++
, so you cannot just deletefirstString
- you should remove all strong references to it. In that case you create strong reference. When you reassignsecondString
it will point to another object. SoNSString
is immutable.Mutable copy creates another string object and you can mutate it