Is there a discrepancy on page 214?


#1

In Figure 29.3 - Initializer chain

The image illustrates that the init method for “Appliance” calls initWithProductName: for “OwnedAppliance” (which would then call initWithProductName: firstOwnerName). However, in Main.m you have us input:

Appliance *a = [[Appliance alloc] init]; NSLog(@"a is %@", a);
This defaults with the name of “Unknown” for the appliance and then the default 120 volts. It doesn’t appear to me that this “Appliance” initializer relates at all to firstOwnerName in “OwnedAppliance” because I can’t find any way to produce the OwnerName results (even if they are nil).


#2

Remember OwnedAppliance is a subclass of Appliance you are calling [[Appliance alloc] init] which is a subclass of NSObject
we go up the chain not down if you did as following code in the main.m you are invoking OwnedAppliance init method.

OwnedAppliance *a = [[OwnedAppliance alloc]init];
NSLog(@"a is %@", a);

#3

I agree with ruxtpin … Figure 33.2 in the Kindle edition shows init: in the BNRAppliance class calling initWithProductName: in the BNROwnedAplliance class. This is obviously incorrect, especially if we are only creating a BNRAppliance object. Also, the dotted lines in Figure 33.2 are inconsistent with the four rules for initialises detailed on the following page. The figure needs updating.