easy to solve doubt

Hello

I need to know what means ::? is an operator? are there other operators like that? where can I find the complete documentation about this kind of command?

thanks a lot

carlos
The :: is what you put do tell the compiler that there is stuff inside a namespace you are looking at. For example:

1
2
3
4
int main() {
   std::cout<<"Hello world!";
   return 0;
}


The std:: tells the compilers to look in the "std" namespace for "cout".
:: is the scope operator. One of its uses is as firedraco says. But it is also used in class and struct context:

1
2
3
4
5
6
7
struct Struc {
   static int x;
};

int x;

std::cout << Struc::x << x << std::endl;


Struc::x says to access the 'x' within Struc. Without the "Struc::" it would otherwise access the (global) x.
Topic archived. No new replies allowed.