![]() |
#2
JanusL2016-04-26 09:29
|
#include "iostream"
using namespace std;
class vehicle
{
protected:
float MaxSpeed;
float Weight;
public:
vehicle(float ms,float w)
{MaxSpeed=ms;
Weight=w;
}
void Run()
{cout<<MaxSpeed<<endl;}
Stop();
void showdata()
{cout<<MaxSpeed<<Weight<<endl;}
};
class bicycle:virtual public vehicle
{
protected:
float Height;
public:
bicycle(float ms,float w,float h):vehicle(ms,w)
{Height=h;}
};
class car:virtual public vehicle
{
protected:
int SeatNum;
public:
car(float ms,float w,int s):vehicle(ms,w)
{SeatNum=s;}
};
class motocycle:public bicycle,public car
{
protected:
int YtNum;
public:
motocycle(float h,int s,float ms,float w,int y):bicycle(h),car(s),vehicle(ms,w)
{YtNum=y;}
};
int main()
{
motocycle m(500,300,20,35,2);
return 0;
}