Question, _privateItems


I’m not sure if I skipped something, in initPrivate, Why did we used the _privateItems instead of self.privateItems.

     self = [super init];
     if (self){
           _privateItems = [[NSMutabaleArray alloc]init];
     return self;

while in allitems we use self.privateItems instead of _privateItems.

-(NSArray *)allItems
    return self.privateItems;

Thank you…


The reason for that is explained in Programming with Objective-C:

  • Encapsulating Data/Access Instance Variables Directly from Initializer Methods


Thank you ibex10