65,211
社区成员
发帖
与我相关
我的任务
分享
class Base{
public:
Base(){
this->i=0;
};
Base(const Base& b){
this->i=b.i;
}
private:
int i;
};
class Derived:public Base{
public:
Derived():Base(){
this->i=0;
}
Derived(const Derived& d):Base(d){//初始化列表调用父类的拷贝构造函数!!!
this->i=d.i;
}
private:
int i;
};
int main(){
Derived d;
Derived c=d;
}