16,471
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
#include<vector>
#include<deque>
#include<list>
#include<string>
using namespace std;
class test{
public:
int a;
int *b;
test(int a){
this->a=a;
b=new int[5];
b[0]=11;
b[1]=12;
cout<<"construct a="<<a<<endl;
}
test(const test & t){
a=t.a+1;
b=new int[5];
cout<<"copy construct"<<"a="<<a<<endl;
}
~test(){
delete[]b;
cout<<"deconstruct"<<"a="<<a<<endl;
}
};
int main(int argc,char**argv){
vector<test> te;
test aa(1);
te.push_back(aa);
cout<<"---"<<endl;
te.push_back(aa);
//te.push_back(a);
char tmp;
cin >>tmp;
return 0;
}