各位亲,请问我下面代码有什么问题啊? 在Xcode里运行不了,请指教,谢谢!
// // main.m // OC1_14 无参方法实现及调用 // // Created by Admin on 16/4/10. // Copyright (c) 2016年 Admin. All rights reserved. //
#import <Foundation/Foundation.h>
typedef enum color{kColorWhite,kColorBlack,kColorTHJ} iColor;
@interface IPhone: NSObject { @public iColor _color; float _size; NSString *_cpu; }
- (void) aboutMyPhone;
- (void) phoneCall :(NSString *) phoneNum;
- (void) sendMassage : (NSString *) phoneNum andContent :(NSString *) content ;
@end
@implementation IPhone
{ - (void) aboutMyPhone{
NSLog(@"color: %d,size: %.2f,cpu :%@",_color,_size,_cpu); - (void) phoneCall :(NSString *) phoneNum{ NSLog(@"给%@打电话",phoneNum); } - (void) sendMassage : (NSString *) phoneNum andContent :(NSString *) content { NSLog(@"给指定的%@发短信,内容是%@",phoneNum,content); } } @end
int main(int argc, const char * argv[]) { @autoreleasepool { iPhone *iPhone7plus = [iphone new]; iPhone7plus--->_color=kColorTHJ; iPhone7plus--->_size=5.9F; iPhone7plus--->_cpu=@"A20"; [iPhone7plus aboutMyPhone]; [iPhone7plus phoneCall:@"10086"]; [iPhone7plus sendMassage:@"10086",andContent:@"联通的客服电话是多少?"]; } return 0; }
|