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 2. The Power of Brackets > Creating New Classes

2.5. Creating New Classes

As you can see, categories can accomplish a lot and provide a great way to extend code that you didn't write. But they have one major limitation: You can't add instance variables in your category definition. And with the NSString class, how could you? The class interface tells you nothing about how the string is stored.

It's time to learn how to create new classes and to extend the Cocoa hierarchy. And to see how that's done, you're going to create a new class that lets you control the number of exclamation points, as in the phrase "THIS IS GOING TO BE AWESOME!!!!!!!"


  

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