O'Reilly logo

Objective-C Fundamentals by Collin Ruffenach, Johannes Fahrenkrug, Christopher K. Fairbairn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required