Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 18. Copying Objects > The copy and mutableCopy Methods

The copy and mutableCopy Methods

The Foundation classes implement methods known as copy and mutableCopy that you can use to create a copy of an object. This is done by implementing a method in conformance with the <NSCopying> protocol for making copies. If your class needs to distinguish between making mutable and immutable copies of an object, you must implement a method according to the <NSMutableCopying> protocol as well. You learn how to do that later in this section.

Getting back to the copy methods for the Foundation classes, given the two NSMutableArray objects dataArray2 and dataArray, as described in the previous section, the statement


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial