rt!

解决方案 »

  1.   

    名字空间的主要作用是解决标识符冲突问题。
    比如C++ Standard Library就是在名字空间std下,如果没有名字空间,其中的list就非常可能和自己定义的一些标识符重复。两种使用方法:
    1、 std::list<int> myIntList;
    2、在cpp文件的开头加上using namespace std;
       这样在文件中就可以直接使用list<int> myIntList了。
      

  2.   

    namespace Declaration
    C++ Specific —>namespace [identifier] { namespace-body }A namespace declaration identifies and assigns a name to a declarative region.The identifier in a namespace declaration must be unique in the declarative region in which it is used. The identifier is the name of the namespace and is used to reference its members.The declarative region of a namespace declaration is its namespace-body.END C++ Specific