Missing code on page 72


It seems that in the program on page 72, there should be a line:

calculator.container = backpack;

Otherwise with the current program, the destroy still happens.


You may have missed the code on page 71. In this chapter, when you override the setter for containedItem, the reciprocal relationship is also set up:

- (void)setContainedItem:(BNRItem *)item
    _containedItem = item;

    // When given an item to contain, the contained
    // item will be given a pointer to its container
    item.container = self;