?? gudie.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 + -