Chapter 6. Extending classes

 

This chapter covers
  • Subclassing
  • Extending classes
  • Creating custom objects
  • Class clusters
  • Categories
  • Existing class modification

 

Classes, which consist of instance variables and methods, can be extended by being modified, expanded, or abstracted. Class extension is one of the fundamental ideas of object-oriented programming. The ability to extend a class promotes code reuse and compartmentalization, and it’s the sign of a well-thought-out project. We investigate the subtleties of the various approaches to extending classes.

6.1. Subclassing

In chapter 5, you learned how to create your own classes. If you look back, you’ll see that the classes you made, such as CTRentalProperty, are subclasses of NSObject ...

Get Objective-C Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.