Computer Science, asked by kalyankv5663, 1 year ago

Explain scope resolution operator in c++

Answers

Answered by PoojaBurra
0

Scope resolution operator is C++ is the only operator which is used to qualify hidden names so that you can still use them.  

You use unary scope operator if namespace global scope is hidden by an explicit declaration of same name in block.

Example of it :-  

#include<iostream>  

using namespace std;  

   

      int x;  

      int main()  

{  

           int x = 10;  

          cout << "Value of global x is " << ::x;  

          cout << "Value of local x is " << x;    

          return 0;  

}

Similar questions