What is scope resolution operator

Explain what is meant by the term scope resolution operator?

E

Expert

Verified

a) Scope resolution operator is used in order to uncover the hidden variables. It also enables access to the global version of the variables.

For example:

#include<iostream. h>
int m=10; // global variable m
void main ( )
{
int m=20; // local variable m
cout<<”m=”<<m<<”\n”;
cout<<”: : m=”<<: : m<<”\n”;
}

output:
20
10 (: : m access global m)

b) Scope resolution operator is also used in order to describe the function outside the class.

Syntax:

Return type <class name> : : <function name>

Eg:

Void x : : getdata()

   Related Questions in C/C++ Programming

2015 ┬ęTutorsGlobe All rights reserved. TutorsGlobe Rated 4.8/5 based on 34139 reviews.