20 Inheritance

When you created the BNRPerson class, you declared it to be a subclass of NSObject. This means that every instance of BNRPerson will have the instance variables and methods defined in NSObject as well as the instance variables and methods defined in BNRPerson. We say that BNRPerson inherits the instance variables and methods from NSObject.

In this chapter, you are going to create a new class named BNREmployee. BNREmployee will be a subclass of BNRPerson.

Figure 20.1  BNREmployee inherits from BNRPerson

BNREmployee inherits from BNRPerson

Makes sense, right? Employees are people. They have heights and weights. But not all people are ...

Get Objective-C Programming: The Big Nerd Ranch Guide 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.