self super
来源:互联网 发布:苏曼莎脸型数据 编辑:程序博客网 时间:2024/05/01 04:33
self
相当于this,它的值可改变,
当一个方法调用同类中的另一个方法时,self不可省略
super
和self指向相同的receiver,但super是要到父类方法列表找对应方法,
只是编译器指示符,不能赋值,而self可以赋值(例如对象的初始化)
//复数相加complex.h-(Complex*)add:(Complex*)a{ Complex* c = [[Complex alloc] init]; c.real = real + a.real; c.imag = imag + a.imag; return [c autorelease];}main.mComplex* c1 = [[Complex alloc]initWithReal:2.1 imag:1.2];Complex* c2 = [[Complex alloc]initWithReal:2.3 imag:3.6];Complex *c = [c1 add:c2];NSLog(@"%g+%gi",c.real,c.imag);
0 0
- self super
- self super
- Self & Super
- self = [super init]
- self = [super init]
- 关键字”self”和”super”
- self and super
- self = [super init]
- self和super 详解
- Object C---super&self
- Object-c self super
- self和super详解
- self = [super init]
- self和super区别
- self 和super
- super和self
- self与super
- self和super
- sql in 用法(mysql)
- java接入阿里云短信sdk 代码
- 设计模式笔记十一:外观模式
- 单片机喇叭音量调节
- PAT甲级1072. Gas Station (30)
- self super
- 使用jadclipse插件 : jad.exe+net.sf.jadclipse_3.3.0.jar反编译
- Jmeter压力测试
- scrapy常用命令
- js中用.和[]访问对象属性的不同
- zoj 1115 水题+找规律
- 每天一题LeetCode[第十六天]
- vs2010统计整个解决方案/工程有多少行代码
- 逻辑回归(Logistic regression)详解-并用scikit-learn训练逻辑回归拟合Iris数据集