Private c++私有属性继承

2017-09-15  本文已影响23人  lcus

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]);

上一篇 下一篇

猜你喜欢

热点阅读