特性用来自动声明属性的setter和gettter方法。
@interface Tire:NSObject
{
float rainHandling;
float snowHandloing;
}
@property float rainHandling;
@property float snowHandling;
@end
@implementation Tire
@synthesize rainHandling;
@synthesize snowHandling;
@end
类别则是向类中添加方法,注意,类别不能添加变量。
@interface Tire (Thing1)
-(void) print;
@end
@implementation Tire (Thing1)
- (void) print
{
NSLog(@"good");
}
@end