class Car {
private:int seetNum =0;int wheelNum;
protected:double price =100;
public:Car();Car(int a);};
class TaixCar : protected Car {
protected:double price =200;// 隐藏 Car::price
public:TaixCar();voidgoHome();};
class FamilyCar : protected TaixCar {
public:voidgoHome();// 使用 Car::price};
输出结果
Car constructor with param
TaixCar constructor without param
TaixCar go home
200
Car constructor with param
TaixCar constructor without param
FamilyCar go home
100