@interface Counter : NSObject
@property int count;
-(void) incByValue: (int) value;
-(void) incByValue: (int) value amount: (int) amount;
@end
@implementation Counter : NSObject
-(void) incByValue: (int) value {
self.count += value;
}
-(void) incByValue: (int) value amount: (int) amount {
self.count += value * amount;
}
@end
Counter *counter = [Counter new];
[counter incByValue:1];
//counter.count is 1
[counter incByValue:2 amount:5];
//Counter.count is 11