what is :: called

Oct 27, 2012 at 6:47pm
Hi,

Can anybody tell me what is :: symbol called in C++?
Oct 27, 2012 at 7:01pm
scope
Oct 27, 2012 at 7:01pm
Scope resolution operator.
Oct 28, 2012 at 5:09pm
thankyou
Oct 28, 2012 at 6:30pm
Examples:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
using namespace std;

int a = 2; // global integer

namespace n 
{
  int a = 3; // namespace integer
}

class c
{
public:
  static const int a = 4; // class integer
};

int main()
{
    int a = 1; // local integer

    cout << a     // local scope (if available locally)
         << ::a   // global scope
         << n::a  // namespace scope
         << c::a  // class scope
         << endl;
}
1234
Last edited on Oct 28, 2012 at 6:33pm
Topic archived. No new replies allowed.