C++ 引用

#include "iostream"

using namespace std;

class AA

{

public:

~AA()

{

cout<<"========="<

}

int a = 2;

};

AA fun(AA &a)

{

a.a = 100;

cout<<"------fun1------"<

return a;

}

 

AA& fun2(AA& a)

{

a.a = 99;

cout<<"------fun2------"<

return a;

}

int main(int arge,char*argv[ ])

{

AA a;

//cout<<"------1------"<

//b = fun(a);

cout<<"------2------"<

a = fun2(a);

cout<<"------fxxxx------"<

a.a = 12;

cout<<"------fyyyy------"<

cout<<"------3------"<

cout<<"------3------"<

cout<<"------3------"<

cout<<"------3------"<

cout<<"------3------"<

cout<<"------3------"<

//system("pause");

return 0;

 

}

你可能感兴趣的:(C++ 引用)