#include <iostream>
#include <string>
using namespace std;
//基类,父类
class Vehicle{
public:
string type;
string contry;
string color;
double price;
int numOfWheel;
virtual ~Vehicle(){};//类中有虚函数,析构函数一般也写成虚函数
virtual void stop()//虚函数,父类暂时不确定用途,子类重写确定用途
{
cout<<"车在跑"<<endl;
}
virtual void run(){};
};
//派生类,子类
class Roadster:public Vehicle{
public:
void stop() override{ //override 关键字在子类重写父类的虚函数
cout<<"跑车在跑"<<endl;
}
void openTopped();
void pdrifting();
};
int main()
{
Roadster paoche;
paoche.stop();
//paoche.type = "保时捷";
//cout<< paoche.type<<endl;
return 0;
}
//虚函数,父类暂时不确定用途,子类重写确定用途//类中有虚函数,析构函数一般也写成虚函数//override 关键字在子类重写父类的虚函数