this指针用于: 1:形参与数据成员一致时 class fg{ public: int g; string d; fg(int g) { this->g=++g; cout<<this->g; }};int main(){ fg d(2);}//输出了3 2:用于函数成员返回自己 class fg{ public: int g; string d; double h; fg(int g) { this->g=g; } fg* v(string a) { d=a; return this; } fg* b(double n) { h=n; return this; } fg V(string A) { d=A; return *this; }};int main(){ fg d(2); d.v("sff")->b(3.333); d.V("sff").b(3.333);}