Marshall Mills wrote:
As I understand it, loaded statement, a using declaration should be all I
need to see an enum from within a namespace. The below code works fine with
class, struct, and union. What gives? As the code says, if I employ the
using directive, I'm ok.
You probably want to restrict your C++ questions to comp.lang.c++. When
you post to both that newsgroup and comp.lang.c, you really should have a
question which could be answered in either language. Those questions are
becoming rarer, with both C++ features not part of C and C features not
part of C++, as well as situations in which the answers are different --
either because the languages are different or because the usual idiom and
normal practice is different in the two languages.
In this case, there is no "using directive" or "using declaration" in C.
Namespace rules differ in the two languages, and named namespaces are not
part of C at all.
I have set followups to comp.lang.c++ only. Should you have a C question,
feel free to post that in comp.lang.c.
[C++ content follows, topical for one of the xposted newsgroups; please
ignore c.l.c]
Why not just use:
namespace Traffic
{
enum Light
{ red, yellow, green };
}
int main(void)
{
Traffic::Light broken = Traffic::red;
return broken;
}
--
Martin Ambuhl