Mega Code Archive

 
Categories / C++ Tutorial / Operators Statements
 

Using the unary scope resolution operator

#include <iostream> using std::cout; using std::endl; int n = 7;  int main() {    double n = 10.5;    cout << "Local double value of n = " << n       << "\nGlobal int value of n = " << ::n << endl;    return 0; } Local double value of n = 10.5 Global int value of n = 7