⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gudie.cpp

📁 c++模板小实验
💻 CPP
字号:
#include<iostream.h>

class vehicle
{public:
    void virtual run()
	{cout<<"this is basic run"<<endl;}
	 void virtual stop()
	{cout<<"this is basic stop"<<endl;}

};

class bicycle: virtual public vehicle
{public:
    void run()
	{cout<<"this is run of bicycle"<<endl;}
	void stop()
{cout<<"this is  stop of bicycle"<<endl;}

};

class motorcar: virtual public vehicle{
public:
    void run()
{cout<<"this is run of motorcar"<<endl;}
	void stop()
{cout<<"this is stop of  motorcar"<<endl;}

};

class motorcycle : public bicycle,public motorcar{
public:
    void run()
{cout<<"this is run of motorcycle "<<endl;}
	void stop()
{cout<<"this is stop of motorcycle "<<endl;}
};

void main()
{vehicle vvv;
vvv.run();

 vehicle *ee;
 ee=&vvv;
 ee->run();

 bicycle bbb;
 bicycle *b1;
 b1=&bbb;
 b1->run();

 motorcar mmm;
 motorcar &m1=mmm;
 m1.stop();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -