扩展

@interface CSize : NSObject
@property int width, height;
@end

@interface CSize (CSizeExtension)
-(id) initWithWidth: (int) width Height: (int) height;
@end

@implementation CSize (CSizeExtension)
-(id) initWithWidth: (int) width Height: (int) height {
    self = [super init];
    if (self) {
        self.width = width;
        self.height = height;
    }
    return self;
}
@end

CSize * size = [[CSize alloc] initWithWidth:4 Height:5];