|
以下是引用janlun86在2006-5-18 18:15:00的发言:
谁能帮我改错啊,实在不知道哪里错了...
#include<iostream.h>
class vehicle
{
public:
int Maxspeed;
int Weight;
vehicle(int M,int W)
{
Maxspeed=M;
Weight=W;
} ;
void run(){cout<<"running"<<endl;};
void stop(){cout<<"stopping"<<endl;};
};
class bicycle:virtual public vehicle
{
public:
int Height;
bicycle(int M,int W,int H):vehicle(M,W)
{
Height=H;
};
};
class motorcar:virtual public vehicle
{
public:
int seatnum;
motorcar(int M,int W,int S):vehicle(M,W)
{
seatnum=S;
};
};
class Motorcycle:public bicycle,public motorcar
{
public:
Motorcycle(int H,int S,int W,int P):bicycle(H,S,W),motorcar(H,S,P),vehicle(H,S)
{
};
void show()
{
cout<<Maxspeed<<Weight<<Height<<seatnum;
};
};
void main()
{
} |
|