The functions of the scope resolution operator include the following.
It helps in resolving the scope of various global variables.
It helps in associating the function with the class when it is defined outside the class.
See the below code in which using the resolution operator we are accessing the global variable,
#include <iostream>
using namespace std;
int data = 0;
int main()
{
int data = 0;
::data = 1; // set global data to 1
data = 2; // set local data to 2
cout << ::data << ", " << data;
return 0;
}
Answer:
The functions of the scope resolution operator include the following.
See the below code in which using the resolution operator we are accessing the global variable,
Output: 1.2
need an explanation for this answer? contact us directly to get an explanation for this answer