Exagon Exagon - 1 year ago 88
C++ Question

Why do we access enum values with ::

My question is simple and maybe stupid.
Whats the design decision behind accessing enum members via

in C++, when we access struct and class members via

Answer Source

:: is used when the left operand is the name of a type or namespace and . is used when the left operand is an object. For the same reason static members of structs or classes are also accessed using ::.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download