In C, the global version of a variable cannot be accessed from within the inner block. C++ resolves this problem by introducing a new operator:: called scope resolution operator. This can be used to uncover a hidden variable. It takes the following form:
:: variable;
This operator allows access to the global version of a variable.
Example:
int student :: roll_no; // Using data members with the help of scope
resolution operator
or
void student :: performance ( ) // Using member function with the
help of scope resolution
operator
{ //Function Body }
Example:
# include<iostream.h >
int m = 10;
int main ( )
{
int m = 20;
{
int k = m;
int m = 30;
cout << “K =”<<k;
cout << “m =”<<m;
cout << “: : m =”<< : : m;
}
cout << “m=”<< m;
cout << “::m =” <<::m;
}
return 0;
}