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

📄 l6_6.cpp

📁 《C++程序设计教程》电子教案及例题源码
💻 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 + -