结构(记录)

//In Objective-C there are no structures constructors
@interface CPoint : NSObject
@property int x, y;
-(idinit;
-(id) initWithX: (int) x andY: (int) y;
@end

@implementation CPoint
-(idinit {
    self = [self initWithX:0 andY:0];
    return self;
}

-(id) initWithX: (int) x andY: (int) y {
    self = [super init];
    if (self) {
        self.x = x;
        self.y = y;
    }
    return self;
}
@end

CPoint *p1 = [[CPoint alloc] initWithX:1 andY:2];
//p1.x is 1 and p1.y is 2

CPoint *p2 = [CPoint new];
//p2.x is 0 and p2.y is 0