#include <vector>
#include <string>
#include <iostream>
using namespace std;
class Test{
public:
static int i;
Test(){
i++;
cout<<i<<endl;
}
Test(string s){
i++;
cout<<i<<" "<<s<<endl;
}
};
int Test::i=0;
Test f1(Test b){
Test c("c");
return c;
}
Test f2(Test b){
return b;
}
int main()
{
Test a("a");
Test b = f1(a);
cout<<Test::i<<endl;
return 0;
}
参数传递和返回值,并不进行类拷贝
猜你喜欢
转载自blog.csdn.net/liuzhuchen/article/details/82918632
今日推荐
周排行