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

Using Class Extensions

You can use anonymous categories. They have the same syntax as named categories, but instead of the name in parentheses, the parentheses are empty as in this example:

@interface MyClass (){
...
}

The methods in an anonymous category must be implemented in the main @implementation section for the class rather than in a separate category .m file. If they are not implemented there, the compiler warns you.

Named categories are implemented in their own .m files. If a method implementation is missing, you are not warned. You can redeclare properties in an anonymous category (changing readonly to readwrite for example) or declare methods that you want to totally hide from people who have access to the interface file of the class.


  

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


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint