C++ this指针

    xiaoxiao2021-04-14  54

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

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

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

     

     

    .

     

    转载请注明原文地址: https://ju.6miu.com/read-670601.html

    最新回复(0)