#import <Foundation/Foundation.h>
@interface Person :NSObject
-(id)init;
@property int age;
@end
@implementation Person
-(id) init{
self=[super init];
_age=99;
return self;
}
@end
int main() {
Person *p3=[[Person alloc] init];
NSLog(@"%d",p3.age);
return 0;
}
为什么要写self????? |
|