#include<iostream>
#include<string>
using namespace std;
class Vehicle{
protected:
int maxspeed,weight;
public:
Vehicle(int m=0,int w=0):maxspeed(m),weight(w){
}
void Running();
void Stop();
void Input();
void Show();
};
void Vehicle::Show()
{
cout<<"maxspeed:"<<maxspeed<<endl;
cout<<"weight:"<<weight<<endl;
}
void Vehicle::Input()
{
cout<<"Input maxspeed:Input weight:";
cin>>maxspeed>>weight;
}
void Vehicle::Running()
{
cout<<"Vehicle is running maxspeed is:"<<maxspeed<<endl;
}
void Vehicle::Stop()
{
cout<<"Vehicle is stop."<<endl;
}
class Bicycle:public Vehicle{
private:
int high;//车高
public:
Bicycle(int m=0,int w=0,int h=0):Vehicle(m,w),high(h){
}
void Running();
void Stop();
void Input();
void Show();
};
void Bicycle::Running()
{
cout<<"Bicycle is running maxspeed is:"<<maxspeed<<endl;
}
void Bicycle::Stop()
{
cout<<"Bicycle is stop."<<endl;
}
void Bicycle::Input()
{
cout<<"Input maxspeed:Input weight:Input high:"<<endl;
cin>>maxspeed>>weight>>high;
}
void Bicycle::Show()
{
Vehicle::Show();
cout<<"high:"<<high<<endl;
}
class Car:public Vehicle{
private:
int seatNum;//座位数
public:
Car(int m=0,int w=0,int s=5):Vehicle(m,w),seatNum(s){
}
void Running();
void Stop();
void Input();
void Show();
};
void Car::Running()
{
cout<<"Car is running maxspeed is:"<<maxspeed<<endl;
}
void Car::Stop()
{
cout<<"Car is stop."<<endl;
}
void Car::Input()
{
cout<<"Input maxspeed:Input weight:Input SeatNum:"<<endl;
cin>>maxspeed>>weight>>seatNum;
}
void Car::Show()
{
Vehicle::Show();
cout<<"seatnum:"<<seatNum<<endl;
}
int main()
{
Bicycle b1(25,30,16),b2;
b1.Show();
cout<<"-----------"<<endl;
b1.Running();
cout<<"-----------"<<endl;
b2.Input();
b2.Show();
cout<<"-----------"<<endl;
b2.Running();
cout<<"-----------"<<endl;
b2.Stop();
cout<<"-----------"<<endl;
Car c1;
c1.Input();
c1.Show();
cout<<"-----------"<<endl;
c1.Running();
cout<<"-----------"<<endl;
c1.Stop();
cout<<"-----------"<<endl;
return 0;
}

