What is Scope Resolution Operator in C++?
There are two used of the scope resolution operator in C++. The first use being that a scope resolution operator is used to unhide the global variable that might have got hidden by the local variables. Hence in order to access the hidden global variable one needs to prefix the variable name with the scope resolution operator (::). e.g. int i = 10; int main () { int i = 20; Cout << i; // this prints the value 20 Cout << ::i; // in order to use the global i one needs to prefix it with the scope //resolution operator. } The second use of the operator is used to access the members declared in class scope. Whenever a scope resolution operator is used the name of the member that follows the operator is looked up in the scope of the class with the name that appears before the operator.
