5_5.cpp
来自「清华大学C++补充习题代码」· C++ 代码 · 共 27 行
CPP
27 行
//5_5.cpp
#include <iostream>
using namespace std;
class Two
{
int y;
public:
friend class One;
};
class One
{
int x;
public:
One(int a,Two &r,int b) {x=a;r.y=b;}
void Display(Two & r) {cout<<x<<" "<<r.y<<endl;}
};
int main()
{
Two ob2;
One ob1(22,ob2,30);
ob1.Display(ob2);
return 0;
}
/*
程序运行结果为:
22 30
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?