#include
using namespace std;
class Vehicle{
public:
stop(){
cout<<"停止"<<endl;
system("pause");
}
run(){
cout<<"I'm vehicle"<<endl;
}
};
class Bicycle:public Vehicle{
public:
run(){
cout<<"I'm Bicycle"<<endl;
}
Bicycle(){};
};
class Motorcar:public Vehicle{
public:
run(){
cout<<"I'm Motorcar"<<endl;
}
};
class Motorcycle:public Bicycle,public Motorcar{
public:
run(){
cout<<"I'm Motorcycle"<<endl;
}
};
int main(int argc,char argv[]){
Vehicle p;
Vehicle veh;
Bicycle bic;
Motorcar mot;
Motorcycle moto;
p=&veh;
p->run();
p=&bic;
p->run();
p=&mot;
p->run();
moto.run();
// p=&moto;
// p->run(); Vehicle类型指针不能指向moto对象
return 0;
}