Using the unary scope resolution operator : Operators « Operators statements « C++ Tutorial






#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








3.1.Operators
3.1.1.Precedence of C Operators
3.1.2.Demonstrating operators .* and ->*.
3.1.3.Using the unary scope resolution operator
3.1.4.Demonstrates built-in arithmetic operators
3.1.5.Using the & and * operators