drdot
drdot

Reputation: 3347

C++ "::" without class name

I came across the following code structure in C++:

uint32_t AClass::Action(....)
{
..
      status = ::Action(...);
..
}

I am not sure what ::Action() means. Which class does it belongs to? NOTE: the argument list of ::Action(...) is different from AClass::Action(...).

Upvotes: 4

Views: 3271

Answers (2)

Anis Belaid
Anis Belaid

Reputation: 304

::Action() mean it is a function under the the global namespace.

Upvotes: -2

Sam Estep
Sam Estep

Reputation: 13354

The leading :: just means that Action here refers to a non-member function in the global namespace, instead of referring to AClass::Action in the current namespace.

Upvotes: 13

Related Questions