enumerated constants

Started by
1 comment, last by TheOne1 20 years, 9 months ago
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.
----Me: So do you know any computer languages?Friend: Ummm....yeah, I used to know l337 talk.Me: ok....
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.
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.

--{You fight like a dairy farmer!}

This topic is closed to new replies.

Advertisement