classFather{
public:
Father(){
this->x=10;
this->y=22;
}
private:
intx;
inty;
};
classSon :Father{
public:
inta;
intb;
};
//Son son;
//son.a =5;
//son.b =6;
//int *p =(int *)&son;
//printf("%d,%d,%d,%d \n",p[0],p[1],p[2],p[3]);
classFather{
public:
Father(){
this->x=10;
this->y=22;
}
private:
intx;
inty;
};
classSon :Father{
public:
inta;
intb;
};
//Son son;
//son.a =5;
//son.b =6;
//int *p =(int *)&son;
//printf("%d,%d,%d,%d \n",p[0],p[1],p[2],p[3]);
本文标题:Private c++私有属性继承
本文链接:https://www.haomeiwen.com/subject/wxossxtx.html
网友评论