refs - // "ri is a reference to n" / cout...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// refs.cpp / // Play around with integer references. Pretty much what // you would expect in Java when dealing with objects. // But C++ lets you create references to primitives. / #include <iostream> using namespace std; u { x = 99; } void references( ) { int n = 5; int & ri = n;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // "ri is a reference to n" / cout << "n = " << n << ", ri= " << ri << endl; c ri = 10; cout << "n = " << n << ", ri= " << ri << endl; c n = 6; cout << "n = " << n << ", ri= " << ri << endl; c changeMe( n ); cout << "n = " << n << ", ri= " << ri << endl; c }...
View Full Document

This note was uploaded on 10/17/2010 for the course SCIS COP 4338 taught by Professor Kipirvine during the Spring '10 term at FIU.

Ask a homework question - tutors are online