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,809
  • 10
  • 35
  • 54

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
  • 223,364
  • 34
  • 402
  • 480
4

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

Kiril Kirov
  • 37,467
  • 22
  • 115
  • 187