黑马程序员技术交流社区

标题: 欧辰 [打印本页]

作者: ioszhangtao    时间: 2015-12-22 21:09
标题: 欧辰
    //iPhone类的声明
typedef enum iphonecolor{hei,bai,thj,mgj} ys;
@interface iphone : NSObject
{   //属性
    @public
    float _size;
    NSString *_cpu;
    ys _color;
}
    //类的行为
- (void)aboutMyphone;
- (void)call:(NSString *)telnum;//打电话,需要传参数
- (void)sendMessage:(NSString *)telnum andcotent:(NSString *)cotent;//发短信
@end

    //类的实现
@implementation iphone
- (void)aboutMyphone{
    NSLog(@"尺寸是:%.2f,颜色是:%d,CPU是:%@,",_size,_color,_cpu);
}
- (void)call:(NSString *)telnum{
    NSLog(@"给%@打电话",telnum);
}
- (void)sendMessage:(NSString *)telnum andcotent:(NSString *)cotent{
    NSLog(@"给%@发短信:%@,",telnum,cotent);
}
彻底懵了




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2