lvalue 참조를 개체의 또 다른 이름으로 간주할 수 있습니다. 주소가 지정된 포인터 형식으로 변환될 수 있는 개체는 유사한 참조 형식으로도 변환될 수 있습니다.
즉, char*로 변환될 수 있는 개체는 char& 형식으로도 변환될 수 있다는 것 입니다.
// reference_declarator.cpp
// compile with: /EHsc
// Demonstrates the reference declarator.
#include <iostream>
using namespace std;
struct Person
{
char* Name;
short Age;
};
int main()
{
// Declare a Person object.
Person myFriend;
// Declare a reference to the Person object.
Person& rFriend = myFriend;
// Set the fields of the Person object.
// Updating either variable changes the same object.
myFriend.Name = "Bill";
rFriend.Age = 40;
// Print the fields of the Person object to the console.
cout << rFriend.Name << " is " << myFriend.Age << endl;
}