Skip to content

Instantly share code, notes, and snippets.

@liyanage
Created November 20, 2009 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liyanage/239297 to your computer and use it in GitHub Desktop.
Save liyanage/239297 to your computer and use it in GitHub Desktop.
// LDFLAGS='-framework Foundation' make test2 && ./test2
#import <Foundation/Foundation.h>
@interface Foo : NSObject {
NSString *bar;
}
@property (retain) NSString *bar;
@end
@implementation Foo
@synthesize bar;
- (void)dealloc {
[bar release];
[super dealloc];
}
@end
int main (int argc, const char *argv[]) {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
Foo *x = [Foo new];
[x setValue:@"test" forKey:@"Bar"];
// [x setValue:@"test" forKey:@"bar"];
NSLog(@"%@", [x valueForKey:@"bar"]);
// NSLog(@"%@", [x valueForKey:@"Bar"]);
[pool release];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment