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

📄 lab8_2.cpp

📁 c++模板小实验
💻 CPP
字号:
#include <iostream.h>
class vehicle
{
public:
	 void run(){cout<<"call vehicle's run"<<endl;}
     void stop(){cout<<"call vehicle's stop"<<endl;}
};

class bicycle:virtual public vehicle
{
	public:
	void run(){cout<<"call bicycle's run"<<endl;}
	void stop(){cout<<"call vehicle's  stop"<<endl;}
};



class motorcar:virtual public vehicle
{	
public:
	void run(){cout<<"call motorcar's run"<<endl;}
	void stop(){cout<<"call motorcar's  stop"<<endl;}
};



class motorcycle:public bicycle,public motorcar
{
public:
	void run(){cout<<"call motorcycle's run"<<endl;}
	void stop(){cout<<"call motorcycle's  stop"<<endl;}
};


void f(vehicle   *str)
{ 
	str->run();
	str->stop();
	return;
}
void main()
{
	vehicle a;
	bicycle b;
    b. run();
	b.stop();
    a.run();
    a.stop();
}
	

⌨️ 快捷键说明

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