010:返回什么才好呢
1 #include <iostream> 2 using namespace std; 3 class A { 4 public: 5 int val; 6 7 A(int 8 i = 123):val(i){}; 9 A& GetObj(){return *this;} 10 }; 11 int main() 12 { 13 int m,n; 14 A a; 15 cout << a.val << endl; 16 while(cin >> m >> n) { 17 a.GetObj() = m; 18 cout << a.val << endl; 19 a.GetObj() = A(n); 20 cout << a.val<< endl; 21 } 22 return 0; 23 }