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

Q&A

Q. What is the purpose of a doubly indirected argument in a method declaration?

A. With a typical argument (single indirection such as NSError *) you pass in a pointer to an instance; you may modify it as a result of the method’s code. (This is common in the init methods.) With double indirection such as NSError **, you typically pass in a nil value and return a new object. (In some cases, you pass in one object and return another.)

Q. Why is the ellipsis not used much at the end of a list of method arguments?

A. The code can be clearer if each argument is named. If you need a flexible number of arguments, consider using one of the collection classes such as NSArray, NSSet, or NSDictionary.


  

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