this指针
来源:互联网 发布:得力美工刀片价格 编辑:程序博客网 时间:2024/06/05 13:34
C++中的this是一个指向对象自身的指针。
例子:
例子:
class Test{ int i, j;public: void set(int a, int b) { this->i = a;//将调用该函数的对象中的成员i 赋值为a this->j = b;//将调用该函数的对象中的成员j 赋值为b }};int main(){ Test t; t.set(10, 20);//这时set函数中的this就是指向t的指针,相当于this=&t; }
0 0
- this指针
- this指针
- this指针
- this指针
- this指针
- this 指针
- this指针
- this指针----
- this指针
- this 指针
- This 指针
- this指针
- This指针
- this指针
- this指针
- this 指针
- this指针
- this指针
- 《黑马程序员》 字符流和字节流 -----第十八天
- 南阳理工OJ_猴子吃桃问题
- 在arc模式下 CGImage 释放问题
- gps hal用到的函数4--socketpair
- mac上传文件到aws ec2 instance
- this指针
- 指针和数组的学习
- socketpair的使用
- SQL锁
- fix协议介绍16-查询叮当(quote)
- C# GetManifestResourceStream获取资源为null
- socketpair的用途以及实现
- mac截图方法
- 【Hackerrank】Merge two sorted linked lists