Write a brief note on scope resolution operator (: :)?
Answers
Answered by
0
Scope resolution Operator(::) in C++ is used to access the hidden instances of a variable inside a given block/scope.
For instance, if a variable int x=20; is defined in a public/global scope and then we again define a variable inside a local scope with the same name as int x=10;
Then, whenever we use x inside that block, we'll get the local value of x (i.e. 10).
So, if we want to use the global value of x, we will use scope resolution operator.
Similar questions