#include<iostream>
using
namespace std;
class A{
public:
A(){ cout << "構造函數!" << endl; }
A(A&){ cout << "複製夠造函數"<<endl;
}
~A(){cout<<"析構函數"<<endl; }
void set(int i){ x = i; }
int get()const{ return x; }
private:
int x;
};
A& fun(A &one){
return one;
}
int main(){
A a;
a.set(11);
A &b = fun(a);
cout << b.get();
return 0;
}
更多詳情請點擊 http://blog.sina.com.cn/zhaojianjunzjj