Creating an Object Alias - C++ Data Type

C++ examples for Data Type:Reference

Description

Creating an Object Alias

Demo Code

#include <iostream> 
#include <string>
using namespace std; 

int main() /*from   w w  w . ja v  a2 s . c  o  m*/
{ 
    string my = "Hello"; 
    const string &StringCopy(my); 

    my = "Goodbye"; 

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

    return 0; 
}

Result


Related Tutorials