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

📄 7_6.cpp

📁 c++书籍的源代码
💻 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 + -