easy to solve doubt
Sep 14, 2008 at 5:11pm UTC
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
Sep 14, 2008 at 5:14pm UTC
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".
Sep 14, 2008 at 9:02pm UTC
:: 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.