C++: Enum definition in class after usage -
is there general way how compilers handle enum definitions in class, in, work use enum in private: define in public: section afterwards?
code example:
class myclass{ private: myenum mymember; public enum myenum { a, b, c }; } it seems work using gpp, proper usage?
you'd need other way round
class myclass{ public: enum myenum { a, b, c }; private: myenum mymember; }; so define enum before use. however, making definition of enum public, storing in private fine - might not want users able write mymember directly, you'd want them understand if class function returned myenum.
Comments
Post a Comment