main.m
#import <Foundation/Foundation.h>
#import "KLine.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
KLine *kline = [KLine new];
[kline setMinPrice:30.2f];
[kline setMaxPrice:50.4f];
NSLog(@"\navPrice = %.2f",[kline avPrice]);
}
return 0;
}
KLine.h
#import <Foundation/Foundation.h>
@interface KLine : NSObject
{
//定义实例变量
float _minPrice;
float _maxPrice;
float _avPrice;
}
//行为
//float _minPrice;
-(void)setMinPrice:(float) minPrice;
-(float)minPrice;
//float _maxPrice;
-(void)setMaxPrice:(float) maxPrice;
-(float)maxPrice;
//float _avPrice;
-(float)avPrice;
@end
|
|