#include <iostream>
using namespace std;
class vehicle
{
private:
char *vehiclename;
public:
vehicle(char *vN)
{
vehiclename=vN;
cout<<"construct vehicle..."<<endl;
cout<<"这个交通工具是:"<<vehiclename<<endl;
}
};
//飞机类
class plane:public vehicle
{
private:
char *planename;
public:
plane(char *planeN):vehicle("飞机"),planename(planeN)
{
cout<<"constrcut plane..."<<endl;
cout<<"这个汽车是:"<<planename<<endl;
}
void start()
{
cout<<"plane startting..."<<endl;
}
void stop()
{
cout<<"plane stopping..."<<endl;
}
};
////火车类 train
class train:public vehicle
{
private:
char *trainname;
public:
train(char *trainN):vehicle("火车"),trainname(trainN)
{
cout<<"construct train..."<<endl;
cout<<"这是火车..."<<endl;
}
void start()
{
cout<<"train startting..."<<endl;
}
void stop()
{
cout<<"train stopping..."<<endl;
}
};
//汽车类 car
class car:public vehicle
{
private:
char *carname;
public:
car(char *carN):vehicle("汽车"),carname(carN)
{
cout<<"constrcut car..."<<endl;
cout<<"这个汽车是:"<<carname<<endl;
}
void start();
void stop();
};
void car::start()
{
cout<<"car startting..."<<endl;
}
void car::stop()
{
cout<<"car stopping..."<<endl;
}
class truck:public car
{
private:
char *truckname;
public:
truck(char *tN):car("大卡车"),truckname(tN)
{
cout<<"construct truckname..."<<endl;
cout<<"这个是大卡车..."<<endl;
}
};
class carriage:public car
{
private:
char *carriagename;
public:
carriage(char *cgN):car("大客车"),carriagename(cgN)
{
cout<<"construct carriage..."<<endl;
cout<<"这个是大客车..."<<endl;
}
};
//小汽车类
class smallcar:public car
{
private:
char *scarname;
public:
smallcar(char *scN):car("小汽车"),scarname(scN)
{
cout<<"construct smallcar..."<<endl;
cout<<"这个小汽车是:"<<scarname<<endl;
}
};
//轿车类
class sedancar:public smallcar
{
private:
char *sedancarname;
public:
sedancar(char *sdcN):smallcar("轿车"),sedancarname(sdcN)
{
cout<<"construct sedancar..."<<endl;
cout<<"这个轿车是:"<<sedancarname<<endl;
}
};
//工具车
class vehiclecar:public smallcar
{
private:
char *vehiclecarname;
public:
vehiclecar(char *vccN):smallcar("工具车"),vehiclecarname(vccN)
{
cout<<"construct vehiclecar..."<<endl;
cout<<"这个小汽车是:"<<vehiclecarname<<endl;
}
};
//面包车类
class sbreadcar:public smallcar
{
private:
char *sbreadcarN;
public:
sbreadcar(char *sbcN):smallcar("小面包车"),sbreadcarN(sbcN)
{
cout<<"construct vehiclecar..."<<endl;
cout<<"这个小汽车是:"<<sbreadcarN<<endl;
}
};
//
int main()
{
sedancar s("本田");
s.start();
s.stop();
cout<<endl;
sedancar s1("奥迪");
s1.start();
s1.stop();
cout<<endl;
carriage c("大客车");
c.start();
c.stop();
cout<<endl;
vehiclecar v("火车");
v.start();
v.stop();
return 0;
}