Graphics Programs Reference
In-Depth Information
call BNRItemStore 's allocWithZone: again, which would then call
sharedStore , which would... well, you get the picture.
Figure 9.8 Not sending allocWithZone: to NSObject causes loop
This is why we had sharedStore call NSObject 's implementation of al-
locWithZone: .
sharedStore = [[super allocWithZone:nil] init];
By sending allocWithZone: to super , we skip over our trap and get an instance of
BNRItemStore when we need it ( Figure 9.9 ).
Figure 9.9 BNRItemStore and NSObject allocation methods
We can only skip over our alloc trap within the implementation of BNRItemStore
because the super keyword is only relevant to the class in which the method is imple-
mented.
 
Search WWH ::




Custom Search