it cannot be operator overloaded.
To access a hidden global variable, use the scope resolution operator ::
The only "special" operators in C++ are those that cannot be overloaded. That is; the dot member operator (.), pointer to member operator (.*), ternary conditional operator (:?), scope resolution operator (::), sizeof() and typeof().
There are 5 operators which cannot be overloaded. They are: * .* - class member access operator * :: - scope resolution operator * . - dot operator * ?:: - conditional operator * Sizeof() - operator Note:- This is possible only in C++.
A member function of a class can be defined outside the class using scope resolution :: operator Thanks Rajneesh
Scope resolution operator is resolved to unhide the scope of a global variable. for eg: #include<iostream.h> int x=20; //global variable void main() { int x=10; //local variable cout<<x; } output will be 10 only. you will never get the answer as 20. local and global variable are having the same name(here x). so unhide the scope of the global variable you have to use a scope resolution operator(::) before the variable. so if you are changing the above code as :cout<<::x; you will get the answer as 20.
:: operator can not be used in C.
No.
The scope resolution operator, ::, overrides local scope and allows access to objects that are hidden due to global to local scope rules.
To access a hidden global variable, use the scope resolution operator ::
You use the scope resolution operator (::) whenever there is ambiguity as to which function or member you are referring to. For instance, if two functions in two separate namespaces have the same signature, you must use scope resolution to call the correct version of the function. Similarly, when calling a base class method from a derived overridden method, you must use scope resolution to ensure the base class method is called from the override.
1. Member-of operator (.) 2. Pointer-to-member-of operator (.*) 3. Ternary condition operator (?:) 4. Scope resolution operator (::) 5. sizeof operator 6. typeid operator