📄 proj8_05.cpp
字号:
#include "iostream.h"
class X
{
public:
friend class Y;
void Set(int i)
{
x = i;
}
void display()
{
cout << "x = " << x << ",y = " << y << endl;
}
private:
int x;
static int y;
};
int X::y = 10;
class Y
{
public:
Y(int i , int j)
{
a.x = i;
X::y = j;
}
void display_X()
{
cout << "x = " << a.x << ".y = " << X::y << endl;
}
private:
X a;
};
void main()
{
Y c(33 , 44);
c.display_X();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -