Scope resolution operator (::) in C++

Scope resolution operator is used to link a class name with a member name . The operator informs the compiler about the class the member belongs. It is also used to allow access to a name in a scope which is hidden by local declaration of same name.

For Example:

#include <iostream>

using namespace std;

class test {

static int a;


static void init(int b) {a = b;}

void show() {cout << a;}


int test::a;

int main()



test b;;

return 0;


Leave a Reply