📄 l6_6.cpp
字号:
#include <iostream.h>
class A
{
private:
int x;
public:
void Display()
{
cout << x << endl;
}
int Getx()
{
return x;
}
friend class B;
};
class B
{
private:
A a;
public:
void Set(int i);
void Display();
};
void B::Set(int i)
{
a.x=i;
}
void B::Display()
{
cout << a.x << endl;
}
void main()
{
B b;
b.Set(10);
b.Display();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -