声明时是这样@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语法
+(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语法
解决方案 »
- 【UIScrollView 设置pagingEnabed后滑动的问题??
- 又一个iPhone博客开张
- 在rootview里一级菜单是课程二级菜单是章节 现在想添加一个三级菜单小节怎么整
- iphone开发环境的建立必须使用mac机器吗 ?
- 疑问,有关IBOutlet的weak & strong reference。
- XCode6中prefix.pch问题
- 如何点击链接打开appstore到指定应用程序页面
- 从xib中加载的view上面的label的无法赋值,是怎么回事?
- https验证服务器证书bug、请大神帮忙(用的是AFNetworking3.0)
- iOS重写tableview的区头的协议方法
- XCode版本和SDK版本
- 求助,关于xcode下使用box2d贴图得问题
second是方法名的一部分
照书上写的转成C后变成:
int funsecond(int a,int b);+:实例函数
-:成员函数这跟C来说比较特例一点〜有点C++的味道〜
我也还在看书中〜
照书上写的转成C后变成:
int a = funsecond(2,3);
很怪〜但是书是这样写的〜IOS6 SDK〜
尤其学过C或C++的〜更晕〜
照书上写的转成C后变成:
int funsecond(int a,int b);+:实例函数
-:成员函数
+(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);
吗?