1 #import <Foundation/Foundation.h> 2 #import "InternalDefiner.h" 3 4 @interface Container : NSObject { 5 @public 6 InternalDefiner *_definer; 7 } 8 9 -(id)init; 10 @end 11 12 @implementation Container 13 14 -(id)init 15 { 16 if (self = [super init]) 17 { 18 _definer = [[InternalDefiner alloc] initWithFoo:4 andBar:5]; 19 } 20 return self; 21 } 22 23 @end 24 25 @interface InheritContainer : InternalDefiner 26 { 27 } 28 29 -(id)init; 30 @end 31 32 @implementation InheritContainer 33 34 -(id)init 35 { 36 if (self = [super initWithFoo:2 andBar:3]) 37 { 38 } 39 return self; 40 } 41 42 @end 43 44 int main(int argc, const char * argv[]) 45 { 46 47 @autoreleasepool { 48 Container *j = [[Container alloc] init]; 49 InheritContainer *k = [[InheritContainer alloc] init]; 50 51 printf("ivar value = %u\n", (unsigned)j->_definer->foo); // Set breakpoint 0 here. 52 printf("ivar value = %u\n", (unsigned)k->foo); // Set breakpoint 1 here. 53 } 54 return 0; 55 } 56 57