Nested namespaces

前端 未结 5 1741
慢半拍i
慢半拍i 2020-11-30 01:08

I\'ve got something like this:

namespace n1
{
    namespace n2
    {
        class foo{}
    }
}
5条回答
  •  死守一世寂寞
    2020-11-30 01:56

    Use namespace aliases:

    using n2 = n1.n2;
    
    ...
    n2.foo something;
    

    What is before the class name should be a complete name space (with/or other class name(s) for nested types). A truncated namespace will not work.

提交回复
热议问题