Skip to content

Instantly share code, notes, and snippets.

@kiliankoe
Created August 9, 2016 15:54
Show Gist options
  • Save kiliankoe/2b32792f25ca9fea7e08a46195afbcbb to your computer and use it in GitHub Desktop.
Save kiliankoe/2b32792f25ca9fea7e08a46195afbcbb to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface Person : NSObject
{
@private char *name;
}
@property (readwrite, assign) char *name;
- (void)sayHello;
@end
@implementation Person
@synthesize name;
- (void)sayHello
{
printf("Hello, my name is %s!\n", [self name]);
}
@end
int main()
{
Person *kilian = [Person new];
kilian.name = "Kilian";
[kilian sayHello];
Person *sexy = [Person new];
sexy.name = "Hendrik";
[sexy sayHello];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment