from the below question i sort of get how enums and namespace scoping works
Scope resolution operator on enums a compiler-specific extension?
However with regard to test code below i'm confused as to why in the below code snippet:
1) i can refer to return type in function signature as test_enum::foo_enum
2) however "using namespace test_enum::foo_enum" is not allowed
namespace test_enum {
enum foo_enum {
INVALID,
VALID
};
}
// Case 1) this is allowed
test_enum::foo_enum getvalue() {
return test_enum::INVALID;
}
//Case 2) is not allowed
using namespace test_enum::foo_enum;
is there a particular reason for not allowing case 2 ?
Also are "enums" more of C style construct and better to avoid in C++ code ?