Tuesday, 15 March 2011

C++: Enum definition in class after usage -


Is there a general way of how compilers are in the NF definitions in the classroom, as such, in the use of this enum To do but it is in the public: section later?

Code example:

  class MyClass {Private: My mail; Public enum My name {A, B, C}; }  

It seems that working with GPP is working, but is it fair use?

You have to do it in another way

  class microloss {public : Enum myEnum {A, B, C}; Private: myEnum myMember; };  

So you define the enum before using it. However, by making the definition of ANUUM, but it is okay to store it in private - you probably do not want users to write directly to myMember , but you want them to understand what it was like if A class function returns a myEnum .


No comments:

Post a Comment