#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;
}
参数传递和返回值,并不进行类拷贝
最新推荐文章于 2024-05-26 15:28:51 发布