Avatar ·

What does double colon "::" mean in C++?

Hi everyone! I recently started learning C++ and came across a construct I can't understand. The double colon "::" appears often in code, but I'm not sure what it does. For example, I've seen code like this: ```cpp #include int main() { std::cout << "Hello" << std::endl; ::system("pause"); return 0; } ``` Here `std::cout` and `::system` — I understand that `std` is a namespace, but why is there a lone `::` before `system`? Or here's another example, when I write my own class: ```cpp class MyClass { public: void print(); }; void MyClass::print() { std::cout << "Hello from MyClass" << std::endl; } ``` Why do I need to write `MyClass::print` when defining a method outside the class? I tried removing `::` and the compiler complained. I also saw in someone else's