假设AA是一个类,AA* abc() const是该类的一个成员函数的原型。若该函数返回this值,当用x.abc ()调用后,x的值是()
#include <iostream> using namespace std; class A { public: A() { this->a = 0; } const A* abc()const //const A const* { this->a = 10; return this; } mutable int a; }; void test() { A a; a.abc(); cout << a.a << endl;//10 } int main() { test(); return 0; }