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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -