Max*_*xpm 20 c++ symbols namespaces class
以下C++代码是否有效?
namespace Foo
{
class Bar
{
// Class code here.
};
}
Run Code Online (Sandbox Code Playgroud)
namespace Foo
{
namespace Bar
{
void SomeFunction();
{
// Function code here.
}
}
}
Run Code Online (Sandbox Code Playgroud)
换句话说,是否可以存在与类同名的命名空间?
qua*_*ana 16
你不能在你的问题中得到你的安排,因为没有办法消除歧义Bar
.
我的编译器说:
error C2757: 'Bar' : a symbol with this name already exists and therefore this name cannot be used as a namespace name
Run Code Online (Sandbox Code Playgroud)