声明时是这样@interface C : NSObject
+(int) fun: (int) a second: (int) b;
@end定义是这样:@implementation C
+(int) fun: (int) a second: (int) b
{
    return a * b;
}
@end使用时是这样:int a = [C fun: 2 second: 3];fun应该是理解为函数名吧?那second理解为什么?
如果second理解为第二个参数的名字,那b又是什么?同时fun又是什么?
object-c语法

解决方案 »

  1.   

    这个方法叫fun:second: 注意两个冒号
    second是方法名的一部分
      

  2.   

    +(int) fun: (int) a second: (int) b;
    照书上写的转成C后变成:
    int funsecond(int a,int b);+:实例函数
    -:成员函数这跟C来说比较特例一点〜有点C++的味道〜
    我也还在看书中〜
      

  3.   

    int a = [C fun: 2 second: 3];
    照书上写的转成C后变成:
    int a = funsecond(2,3);
      

  4.   

    C fun 的 C 是类
    很怪〜但是书是这样写的〜IOS6 SDK〜
      

  5.   

    别怪我〜这本书12XX多页〜我也才看不到100页就快晕倒了〜
    尤其学过C或C++的〜更晕〜
      

  6.   

    +(int) fun: (int) a second: (int) b;
    照书上写的转成C后变成:
    int funsecond(int a,int b);+:实例函数
    -:成员函数
      

  7.   


    +(int) fun: (int) a second: (int) b;
    也可以改成这样吗?
    +(int) f: (int) a unsecond: (int) b;
    +(int) fu: (int) a nsecond: (int) b;
    +(int) funs: (int) a econd: (int) b;
    +(int) funse: (int) a cond: (int) b;
    +(int) funseco: (int) a nd: (int) b;
    .....
    都等于
    int funsecond(int a,int b);
    吗?