标签:style io ar color os sp on div log
@interface Person : NSObject
{
int myNumber;
}
@property(nonatomic) int myNumber;//这个关键字是可以带套get 与set函数的表达
//-(int)myNumber;
//-(void)setMyNumber:(int)_number;
-(void)print;
#import "Person.h"
@implementation Person
@synthesize myNumber;//这两个关键字是一起用的
//-(int)myNumber{
// return myNumber;
//}
//-(void)setMyNumber:(int)_number{
// myNumber=_number;
//}
-(void)print{
NSLog(@"Person: %d",myNumber);
}
int main(int argc, const char * argv[]) {//因为这两个关键字可以不用get set方法调用
@autoreleasepool {
Person *son=[[Person alloc]init];
[son setMyNumber:100];
NSLog(@"person: %d",[son myNumber]);
}
标签:style io ar color os sp on div log
原文地址:http://www.cnblogs.com/daijiahong/p/4147313.html