A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 和夏一样狂热 中级黑马   /  2015-8-7 22:22  /  418 人查看  /  3 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

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

3 个回复

倒序浏览
赞 不错   收藏了
回复 使用道具 举报
加油加油
回复 使用道具 举报
加油加油
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马