-
前引
无意识(寄
-
他人思路鸣谢
无
-
我的代码
#include <iostream>
using namespace std;
class A
{
public:
int x;
int getX() { return x; }
};
void swap(A& a,A& b)
{
int tmp = a.x;
a.x = b.x;
b.x = tmp;
}
int main()
{
A a,b;
a.x = 3;
b.x = 5;
swap(a,b);
cout << a.getX() << "," << b.getX();
return 0;
}
-
解析