Private c++私有属性继承
程序员文章站
2022-03-08 19:29:39
...
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]);