Let’s be honest; that looks a little crazy. If you are learning Objective-C after using another language (like JavaScript, for example), this can be a little hard to read and understand.
【 在 isup (No) 的大作中提到: 】 : 特别是method的定义和调用 : - (int)addX:(int)x toY:(int)y { : int sum = x + y; : return sum; : } : 难道下面这个语法不是更好理解吗 : int addXtoY(int x, int y) { : int sum = x + y; : return sum; : }
特别是method的定义和调用
- (int)addX:(int)x toY:(int)y {
int sum = x + y;
return sum;
}
难道下面这个语法不是更好理解吗
int addXtoY(int x, int y) {
int sum = x + y;
return sum;
}
Let’s be honest; that looks a little crazy. If you are learning Objective-C after using another language (like JavaScript, for example), this can be a little hard to read and understand.
【 在 isup (No) 的大作中提到: 】
: 特别是method的定义和调用
: - (int)addX:(int)x toY:(int)y {
: int sum = x + y;
: return sum;
: }
: 难道下面这个语法不是更好理解吗
: int addXtoY(int x, int y) {
: int sum = x + y;
: return sum;
: }
没有人喜欢吧
我觉得后面的好。
【 在 isup (No) 的大作中提到: 】
: 特别是method的定义和调用
: - (int)addX:(int)x toY:(int)y {
: int sum = x + y;
: return sum;
: }
: 难道下面这个语法不是更好理解吗
: int addXtoY(int x, int y) {
: int sum = x + y;
: return sum;
: }
: ...................
古代的smalltalk式OOP语法
【 在 isup (No) 的大作中提到: 】
: 特别是method的定义和调用
: - (int)addX:(int)x toY:(int)y {
: int sum = x + y;
: return sum;
: }
: 难道下面这个语法不是更好理解吗
: int addXtoY(int x, int y) {
: int sum = x + y;
: return sum;
: }
: ...................