Creating a C++ namespace in header and source (cpp)

前端 未结 8 1573
猫巷女王i
猫巷女王i 2020-12-23 00:22

Is there any difference between wrapping both header and cpp file contents in a namespace or wrapping just the header contents and then doing using namespace

8条回答
  •  再見小時候
    2020-12-23 01:06

    I think right thing to do here is to use namespace for scoping.

    namespace catagory
    {
        enum status
        {
          none,
          active,
          paused
        }
    };
    
    void func()
    {
        catagory::status status;
        status = category::active;
    }
    

提交回复
热议问题