The scope operator is used to refer to member of global namespace between the global name space does have the name, the rotation ::
Namespace is a collection of
namespace N { Classes } int x; global variable void main (); global name space { int x=10; int y =20; void main() cout <<y; - > 20 { cout<<x; - > 20 int x=20; } cout<<x; -> 20 cout<< :: x; cout<<N :: x;
# include <iostream.h> int x=10; void main() { int y=20; cout<< “\n local variable y=” <<y; 20 cout<<”\n global variable u=”<<x;10 cout<<”\n global variable x=”<< :: x; }
# include <iostream.h> { int x=10; int y=10; void main() { int z=30; int x=40; { cout<< end l<< x; // 50 cout<< end l << :: x; //10 cout<<end l << z; //30 cout<< end l<<y; // 20 cout<< end l<<::y; } cout << endl<<x; // 40 cout << endl << Z; //30 cout << endl<<:: x; //20 coout<<endl<<::y; //20 }
You liked the article?
Like: 1
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.