?? 7_6.cpp
字號:
#include<iostream.h>
class child;
class mother
{
public:
void singing();
friend void fun2(mother &p);
private:
void teaching(int h);
};
void mother::singing()
{
cout<<"唱歌"<<endl;
}
void mother::teaching(int h)
{
cout<<"做"<<h<<"小時的家教"<<endl;
}
class father
{
public:
friend mother;
friend void fun1(father &p1,child &p2);
void driving();
protected:
void repairing();
};
void father::driving()
{
cout<<"開車"<<endl;
}
void father::repairing()
{
cout<<"修電腦"<<endl;
}
class child:public father,public mother
{
public:
friend void fun1(father &p1,child &p2);
void play_pp(char s[30]);
};
void child::play_pp(char s[30])
{
cout<<"在"<<s<<"俱樂部打乒乓球"<<endl;
}
int main()
{
void fun1(father &p1,child &p2);
void fun2(mother &p);
father s1;
mother s2;
child s3;
s1.driving();
s2.singing();
fun2(s2);
s3.play_pp("飛魚");
s3.driving();
s3.singing();
fun1(s1,s3);
return(0);
}
void fun1(father &p1,child &p2)
{
p1.repairing();
p2.repairing();
}
void fun2(mother &p)
{
p.teaching(2);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -