this指针
Posted -asurada-
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了this指针相关的知识,希望对你有一定的参考价值。
1.C++程序到C程序的翻译
class Test { public: int price; void setPrice(int p); }; Test::setPrice(int p) { price=p; }
struct Test { int price; }; void setPrice(struct Test* this,int p) { this->price=p; }
2.其作用就是指向成员函数所作用的对象
3.特殊用法:return *this;返回当前操作的对象
4.静态成员函数中不能使用this指针
以上是关于this指针的主要内容,如果未能解决你的问题,请参考以下文章