📄 rail_vehicle.h
字号:
using namespace std;
class RailVehicle
{
private:
protected:
RailVehicle *front;
RailVehicle *back;
int typeOfVehicle;
public:
//RailVehicle();
RailVehicle* getFirst();
RailVehicle* connectToNext( RailVehicle * );
int getSpeed();
void showAll( ostream&);
int getMassAll();
virtual ~RailVehicle();
virtual void showThis( ostream&)const = 0;
virtual int getMassThis()const = 0;
};
class Engine : public RailVehicle
{
private:
int mass,
maxSpeed,
maxWeight,
currentSpeed;
public:
Engine(int, int, int);
~Engine();
int checkMaxSpeedAvailable();
void changeSpeed(int );
int getMaxWeight();
int getCurrentSpeed();
int getMaxSpeed();
void showThis(ostream &)const;
virtual int getMassThis()const;
};
class Cargo
{
private:
Cargo * cargoPtr;
public:
int mass;
string name;
Cargo *nextCargo;
RailVehicle *car;
Cargo(string, int);
~Cargo();
int getMassThis();
Cargo* findLastCargo( Cargo * );
};
class FreightCar : public RailVehicle
{
private:
int mass;
Cargo *cargoPtr;
public:
FreightCar(int);
~FreightCar();
void addFreight(Cargo *);
Cargo * removeFreight();
virtual int getMassThis()const;
void showThis(ostream &)const;
void showCargo(ostream &);
};
class MyException
{
public:
string msg;
MyException(string msg_)
{
msg = msg_;
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -