Copy of iOS

Source: Internet
Author: User
Copy & mutablecopy Use the Copy or Mutablecopy method to create a copy of an object that you need to implement the Nscoppying protocol to create an immutable copy (such as NSString, Nsarray, Nsdictionary) Mutablecopy need to implement nsmutablecopying protocol to create a mutable copy (such as nsmutablestring, Nsmutablearray, Nsmutabledictionary) The purpose of copy is to make a copy, while modifying the original object and the replica does not interfere with each other deep copy: content copy, source object and copy point to different two object source object reference counter unchanged, copy counter set to 1 address value change shallow copy: pointer copy, The source object and the copy point to the reference counter of the same object object +1, which is actually equivalent to doing a retain operation address value does not change only the immutable object creates the immutable copy (copy) is the shallow copy, the other is the deep copy

Copy of iOS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.