#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