我的拷贝构造函数哪写错了?
#include<iostream>#include<vector>using namespace std;class Base{ public: Base(){count=0;cout<<"Construct! "<<count<<"time"<<endl;count++;} Base(Base &b); void show(){cout<<"count = "<<count<<endl;} int count; };Base::Base(Base &b){ count=b.count; cout<<"copyConstruct!"<<endl;}int main(){ Base b1; Base b2; Base b3; vector<Base> v1; v1.push_back(b1); v1.push_back(b2); v1.push_back(b3); vector<Base>::iterator iv; for(iv=v1.begin();iv!=v1.end();iv++){ (*iv).show(); } Base bx= v1.at(0); bx.show(); system("pause"); return 0; }