引用类中的enum,需要加类的域
class_name::value_in_enum_name
- #include <stdio.h>
- #include <stdlib.h>
- class A{
- public:
- enum ee{
- a = 0,
- b,
- max
- };
- };
- class B{
- public:
- enum ee{
- a = 1,
- b,
- max
- };
- };
- int
- main ( int argc, char *argv[] )
- {
- printf("%d\n",A::max);
- printf("%d\n",B::max);
- }
输出:
2
3
阅读(997) | 评论(0) | 转发(0) |