Skip to content

💡 TL;DR:Basics and beyond: namespaces.

Last updated:2026-10-13

C++ Namespaces

About the Author:

Personal WeChat official account:

C++ Namespaces | C++那些事

  • Global scope operator (::name): used before a type name (class, class member, member function, variable, etc.) to indicate that the scope is the global namespace
  • Class scope operator (class::name): used to indicate that the scope of the given type is a specific class
  • Namespace scope operator (namespace::name): used to indicate that the scope of the given type is a specific namespace

For the concrete code see: maohao.cpp

Comments