//
// main.m
//
#import <Foundation/Foundation.h>
@interface Person : NSObject
{
@public
int _age;
NSString *_name;
}
-(void)run;
@end
@implementation Person
-(void)run{
NSLog(@"人正在跑");
}
@end
int main(int argc, const char * argv[]) {
@autoreleasepool {
Person *p = [Person new];
p->_name = @"柯南";
p->_age = 13;
NSLog(@"姓名:%@,年龄:%d",p->_name,p->_age);
[p run];
}
return 0;
} |
|