可能重复:
如何在C++中将枚举导入不同的命名空间?
如何解决以下枚举命名空间问题?
namespace A {
typedef enum ABar { a, b };
void foo( ABar xx ) {}
}
namespace B {
typedef enum A::ABar BBar;
void foo( BBar xx ) { A::foo( xx ); }
}
int main() {
B::foo( B::a ); // 'a' : is not a member of 'B'
// 'a' : undeclared identifier
}
Run Code Online (Sandbox Code Playgroud)