1

I have this code:

1. bool MyClass::open() {
2.   int fd = ::open("file.txt",flags);
3. }

Does the "::" from the line 2 before calling open means something?

georgiana_e
  • 1,709
  • 7
  • 30
  • 51

2 Answers2

11

It means "open from the global namespace". It is a way to disambiguate with MyClass::open, which is a name that would be picked up if you said open without the leading ::.

juanchopanza
  • 216,937
  • 30
  • 383
  • 461
4

It's scope resolution operator and it says, that the function (open in this case) is in the global namespace.

Kiril Kirov
  • 36,509
  • 22
  • 109
  • 183