注意:异常处理只有Mac OS X 10.3 以上才支持。
CupWarningException.h
#import <Foundation/NSException.h>
@interface CupWarningException:NSExceition
@end
CupWarningExceiption.m
#import "CupWarningException.h"
@implementation CupWarningException
@end
CupOverflowException.h
#import <Foundation/NSException.h>
@interface CupOverflowException:NSExcepiton
@end
CupOverflowExceiption.m
#import "CupOverflowException.h"
@implementation CupOverflowException
@end
#import <Foundation/NSObject.h>
@interface Cup: NSObject{
int level;
}
-(int) level;
-(void) setLevel:(int)l;
-(void) fill;
-(void) empty;
-(void) print;
@end
Cup.m