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 | @property (nonatomic, strong) NSMutableArray *filteredDataSource; |
27 | -(id)init; |
28 | @end |
29 | |
30 | @implementation InheritContainer |
31 | |
32 | -(id)init |
33 | { |
34 | if (self = [super initWithFoo:2 andBar:3]) |
35 | { |
36 | self.filteredDataSource = [NSMutableArray arrayWithObjects:@"hello" , @"world" , nil]; |
37 | } |
38 | return self; |
39 | } |
40 | |
41 | @end |
42 | |
43 | int main(int argc, const char * argv[]) |
44 | { |
45 | @autoreleasepool { |
46 | Container *j = [[Container alloc] init]; |
47 | InheritContainer *k = [[InheritContainer alloc] init]; |
48 | |
49 | printf("ivar value = %u\n" , (unsigned)j->_definer->foo); // breakpoint1 |
50 | printf("ivar value = %u\n" , (unsigned)k->foo); |
51 | } |
52 | return 0; |
53 | } |
54 | |
55 | |