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

📄 4.3-引用赋值.cpp

📁 Visual C++的课件
💻 CPP
字号:
//Listing 9.3
//Reassigning a reference

#include <iostream.h>

int main()
{
	int  intOne;
	int &rSomeRef = intOne;

	intOne = 5;
	cout << "intOne:\t" << intOne << endl;
	cout << "rSomeRef:\t" << rSomeRef << endl;
	cout << "&intOne:\t"  << &intOne << endl;
	cout << "&rSomeRef:\t" << &rSomeRef << endl;

	int intTwo = 8;
	rSomeRef = intTwo;  // not what you think!
	cout << "\nintOne:\t" << intOne << endl;
	cout << "intTwo:\t" << intTwo << endl;
	cout << "rSomeRef:\t" << rSomeRef << endl;
	cout << "&intOne:\t"  << &intOne << endl;
	cout << "&intTwo:\t"  << &intTwo << endl;
	cout << "&rSomeRef:\t" << &rSomeRef << endl;
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -