可在该命名空间中定义命名空间的成员。 例如:
namespace X { void f() { } }
指定的命名空间的成员可以在定义的名称的显式限定所声明的命名空间的外部进行定义。 但是,要定义的实体必须已在命名空间中进行声明。 此外,定义必须出现在包含声明的命名空间的命名空间中的声明位置的后面。 例如:
// defining_namespace_members.cpp
// C2039 expected
namespace Q {
namespace V {
void f();
}
void V::f() { } // ok
void V::g() { } // C2039, g() is not yet a member of V
namespace V {
void g();
}
}