?? 練習.txt
字號:
//************************
//** main.cpp **
//************************
#include <iostream.h>
#include "famo.h"
void main()
{
Father fa;
Mother mo;
Child ch;
cout<<"a new day start..."<<endl;
cout<<"father:"; fa.Drive();
cout<<"mother:"; mo.Sing(); mo.PJ();
cout<<"child:"; ch.PlayBall();
cout<<endl<<"then father drive back..."<<endl;
cout<<"child:"; ch.Drive(); ch.Sing();
cout<<endl<<"in the evening..."<<endl;
cout<<"father:"; fa.Mend();
cout<<"child:"; ch.Mend();
}
//**********************
//** famo.h **
//**********************
#include <iostream.h>
class Father
{
public:
void Drive() {cout<<"driving car."<<endl;}
void Mend() {MendTV();}
protected:
void MendTV() {cout<<"repair TV."<<endl;}
};
class Mother
{
public:
void Sing() {cout<<"singing."<<endl;}
void PJ() {PartJob();}
private:
void PartJob() {cout<<"doing parttime job."<<endl;}
};
class Child:public Father,public Mother
{
public:
void PlayBall() {cout<<"playing ball."<<endl;}
};
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -