Chapter 2 - Initializers


#1

Hello,
at Using Initializers paragraph there something missing;
code should be like this:

#import <Foundation/Foundation.h>
#import "BNRItem.h"

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        
        BNRItem *p = [[BNRItem alloc] init];
        NSLog(@"%@", p);
        
        [p setItemName:@"Red Sofa"];
        [p setSerialNumber:@"A1B2C"];
        [p setValueInDollars:100];
        NSLog(@"%@", p);
       
    
    }
    return 0;
}

but in the page the code is:

#import <Foundation/Foundation.h>
#import "BNRItem.h"

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        
        BNRItem *p = [[BNRItem alloc] init];
        NSLog(@"%@", p);
        
        [p setItemName:@"Red Sofa"];
        
    }
    return 0;
}

#2

The rest of the code in the .m file was removed from the book for brevity. Notice that in this section, there is one line of bold code and a few lines of non-bold code.

The bold code is the line you need to type. The non-bold code is to be used as a guide for where to place the bold code.