November 2013
Beginner
325 pages
9h 47m
English
In the NSObject class, there is a method named init. Using init looks like this:
NSMutableArray *things = [[NSMutableArray alloc] init];
You send the init message to the new instance so that it can initialize its instance variables to usable values; alloc creates the space for an object, and init makes the object ready to work. Notice that init is an instance method that returns the address of the initialized object. It is the initializer for NSObject. This chapter is about how to write initializers.
Create a new project: a Foundation Command Line Tool called Appliances. In this program, you are going to create two classes: BNRAppliance and BNROwnedAppliance (a subclass of BNRAppliance ...
Read now
Unlock full access