啊
class A {
enum E {one , two , three};
struct B {
char a;
E num;
};
static const B arr[];
}
Run Code Online (Sandbox Code Playgroud)
A.cpp
const B A::arr[] = {
{'1', one},
{'2', two},
{'3', three}
};
Run Code Online (Sandbox Code Playgroud)
编译时出现以下错误:'B'没有命名类型
B是在范围内定义的A,因此您需要通过其全名来引用它:
const A::B A::arr[] = { ....
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
240 次 |
| 最近记录: |