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

📄 proj8_05.cpp

📁 C++程序设计教程的全部源代码 包含与教程同步的PPT 方便学习
💻 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 + -