SeriousTyro
SeriousTyro

Reputation: 954

What does "::" (double colon) mean?

I've seen :: in some documentations, e.g., xn::Generator::StartGenerating(), and was wondering what it exactly signified?

Upvotes: 0

Views: 5501

Answers (4)

Jamie Dixon
Jamie Dixon

Reputation: 54021

To add to the answers already here, after doing a quick google for "Double colon notation" I came across the following for PHP:

In short, it’s used to access Static or Constant members of a class

Source: http://www.whypad.com/posts/php-using-the-double-colon/500/

There's a brief discussion here on Stack Overflow also on the differences between the double colon and and arrow operators.

Upvotes: 0

Patrick87
Patrick87

Reputation: 28332

In C++, that's scoping names so that it can tell what you're talking about. Namespace (like std::cout) and class member definitions (like MyClass::MyMethod) come to mind.

Upvotes: 1

riwalk
riwalk

Reputation: 14233

In C++ at least, it refers to some sort of scope resolution. This could be a namespace (for example StartGenerating is a function within the namespace Generator), or it could be a class (for example StartGenerating is a static function in the class Generator)

Either way, it narrows the scope in which C++ will search for an identifier.

Upvotes: 0

Related Questions