Scope Resolution Operator in C++ Example Tutorial is today’s topic. Scope resolution operator is used to access functions, variables which are not present in that particular scope but are existing in the program. In other words, the scope resolution operator is used to define the  function outside a  class; We can also use it to set a global variable which has the same name as of a local variable in that particular scope.

#Scope Resolution Operator in C++

The :: (scope resolution) operator is used to get the hidden names due to the variable scopes so that you can still use them.

The scope resolution operator can be used as both as unary and binary.

You can use a unary scope operator if the  namespace scope or global scope name is hidden by the particular declaration of an equivalent name during a block or class.

For example, if you have the global variable of name my_var and the local variable of name data_var, to access global data_var, you’ll need to use a scope resolution operator.

#c++ #scope resolution operator in c++ #scope resolution operator

Scope Resolution Operator in C++ Example Tutorial
8.15 GEEK