// page189.cpp : 定义控制台应用程序的入口点。
//C++面向对象程序设计
//展示传值调用参数和传引用调用参数的区别
#include "stdafx.h"
#include <iostream>
void do_stuff(int par1_value , int& par2_ref);
//par1_value 是传值调用参数 , par2_ref是传引用调用参数
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std ;
int n1 ,n2 ;
n1 = 1 ;
n2 = 2 ;
do_stuff(n1 , n2);
cout << " n1 after function call = " << n1 << endl ;
cout << " n2 after function call = " << n2 << endl ;
cin >> n1 ;
return 0;
}
void do_stuff (int par1_value , int& par2_ref)
{
using namespace std;
par1_value = 111;
cout << " par1_value in function call = "
<< par1_value << endl ;
par2_ref = 222 ;
cout << " par2_ref in function call = "
<< par2_ref << endl;
return ;
}