1、函数的声明:
- (void)eat;//1.1无返回值,也无参数
- (void)eatWithType:(NSString *)type;//1.2无返回值,有参数
- (NSString *)eat;//1.3有返回值,无参数
- (NSString *)eatWithType:(NSString *)type;//1.4有返回值,有参数
2、函数的定义:
- (void)eat {//1.1无返回值,也无参数
}
- (void)eatWithType:(NSString *)type {//1.2无返回值,有参数
}
- (NSString *)eat {//1.3有返回值,无参数
}
- (NSString *)eatWithType:(NSString *)type{//1.4有返回值,有参数
}
3、函数的调用:
[self eat];//1.1无返回值,也无参数
[self eatWithType:@"fruit"];//1.2无返回值,有参数
NSString *type = [self eat];//1.3有返回值,无参数
NSString *type =[self eatWithType:@"fruit"];//1.4有返回值,有参数
网友评论