Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TheOne1

enumerated constants

This topic is 5619 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i was wondering 2 things. 1. enum BREED { GOLDEN, LABRADOR } Now, I know that GOLDEN = 1, and LABRADOR = 2 but do enumerated constants have a type? Like int, short unsigned, etc. 2. enum BREED { GOLDEN, LABRADOR } ..... //code ......//code, etc, etc, BREED breed; Is BREED breed kind of like an variable type? Kind of like int x, y; or is it like a class type like: DOG Brownie;? Kind of confusing sorry, ill clear it up if to hard to understand.

Share this post


Link to post
Share on other sites
Advertisement
Well, I know the constants that are declared with an enumeration are integers. The enum itself however, I don''t really know. Isn''t it just a new type, in your case BREED.

And also, the values will start with 0: GOLDEN = 0 and LABRADOR = 1.

Share this post


Link to post
Share on other sites
Well if I had to classify it I would say that enum is one way to create user-defined types. Those int, float, double etc. are all built-in types, meaning you don''t have to define them to use them. Enum is really more of an aesthetic feature so that you''re code is easier to read using words instead of numbers but the actual internal representation of it is still an int type.





You fight like a dairy farmer.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!