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

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 15132876050 中级黑马   /  2015-8-18 21:32  /  455 人查看  /  1 人回复  /   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

1 个回复

倒序浏览
封装我那里没有学好  还的努力补习
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马