Created
June 1, 2009 14:45
-
-
Save akio0911/121456 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface Person : NSObject | |
{ | |
NSString *name; | |
NSString *email; | |
int age; | |
} | |
@end | |
@implementation Person | |
@end | |
@interface WorkingGroup : NSObject | |
{ | |
Person* leader; | |
NSMutableSet* members; | |
} | |
@end | |
@implementation WorkingGroup : NSObject | |
@end | |
int main() { | |
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; | |
WorkingGroup* aGroup = [[WorkingGroup alloc] init]; | |
[aGroup setValue:[[Person alloc] init] forKey:@"leader"]; | |
[aGroup setValue:@"suzuki" forKeyPath:@"leader.name"]; | |
id name = [aGroup valueForKeyPath:@"leader.name"]; | |
NSLog(@"%@", name); | |
[pool release]; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment