C++ Reference Creating an Object Alias

Description

C++ Reference Creating an Object Alias

#include <iostream> 

using namespace std; 

int main() /*from   w  w  w  .j  a v  a 2  s  .  c  om*/
{ 
    string my = "Hello"; 
    const string &StringCopy(my); 

    my = "Goodbye"; 

    cout << my << endl; 
    cout << StringCopy << endl; 

    return 0; 
}



PreviousNext

Related