#ifndef _TAXI_
#define _TAXI_
#include<iostream>
#include<string>
using namespace std;
class Car {
private:
int carnum;
string carname;
public:
Car() {
}
Car(int carnum_,string carname_):carnum(carnum_),carname(carname_){}
virtual void show()
{
cout << carnum << ' ' << carname << endl;
}
};
class Taxi:public Car {
private:
int money;
public:
Taxi(int money_, string carname_, int carnum_) :Car(carnum_, carname_) {
money = money_;
}
Taxi(Taxi &t)
{
money = t.money;
}
virtual void show()
{
cout << money <<endl;
}
};
#endif
#include"Taxi.h"
#include<iostream>
using namespace std;
int main()
{
Car t1;
Taxi t2(188, "lixiang", 188);
Taxi t3(t2);
t3.show();
Car *p = new Taxi(12, "jj", 13);
p->show();
system("pause");
return 0;
}