Subclassing an Objective-C Class

In this section, you are going to create a new class named BNRItem. BNRItem will be a subclass of NSObject.

Figure 2.9  Class hierarchy including BNRItem

Class hierarchy including BNRItem

An instance of BNRItem will represent something that a person owns in the real world, like a laptop, a bicycle, or a backpack. In terms of Model-View-Controller, BNRItem is a model class. An instance of BNRItem stores information about a possession.

Once you have created the BNRItem class, you will populate the items array with instances of BNRItem instead of NSString.

Figure 2.10  A different class of items

Later in the book, ...

Get iOS Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.