Write a program to show the use of the scope resolution operator(::)
#include<iostream> using namespace std; int x = 4; int main() { int x = 2; cout << "x = " << x << endl; cout << "x = " << ::x << endl; { int x = 15; cout << "x = " << x << endl; cout << "x = " << ::x << endl; } return 0; }
Output
x = 2 x = 4 x = 15 x = 4