C++ this指针

来源:互联网 发布:windows ce6.0应用软件 编辑:程序博客网 时间:2024/06/05 04:34

    每一个成员函数(静态成员函数除外)都有一个this隐藏的指针类型的形参this,其类型为: <类型> *const this;

    当能够区分各种成员时,可以不用使用this指针,否知可以通过使用this指针来区分。

class A{   int x,y;public:   void f();   void g(int x){     this.x = x;   }}


.

0 0
原创粉丝点击