A namespace is a scope.C++ provides namespaces to prevent name conflicts.A namespace is a mechanism for expressing logical grouping. That is, if some declarations logically belong together to some criteria(准则), they can be put in a common namespace t…
关于namespace,双冒号::的用法. 防止引用多个模块在一个文件/类中,有重名的对象.::可以调用类的类方法,和常量. class Foo BAR = "hello" def self.hello puts "world" end end p Foo::BAR ✅ Foo::hello ✅ 根据用法规范,不建议用::给类的对象引用实例方法,应该用. (period句号) SelfYield. 当给方法传递一个块时,你期望这个方法会通过y…