O'Reilly logo

Objective-C Quick Syntax Reference by Matthew Campbell

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 18

image

Inheritance

When you want to code a new class that shares most of the properties and methods of another class, you can use inheritance. A class that is inherited from another class takes on all the properties and methods of the superclass.

You use inheritance when you want to leverage the work that has already been completed and then add more properties and methods to customize the new class. This pattern gives us code reuse.

You saw examples of inheritance in Chapter 16: when you created the Project class, you inherited NSObject. This gave Project all the methods and properties of NSObject.

A more interesting application happens when ...

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