[Tutor] enumeration in C++

Nicole Seitz nicole.seitz@urz.uni-hd.de
Tue, 2 Apr 2002 17:17:16 +0200


Am Montag,  1. April 2002 18:05 schrieben Sie:
> On Mon, 1 Apr 2002, Cameron Stoner wrote:
> > Currently in college right now, I have come across enumeration in C++
> > and wanted to know if Python can do the same thing and how?
>
> Almost.  In C++, we can create an enumeration with the following:
>
> ///
> enum {red, white, blue} color;
> color c = red;
> ///
>
>
> One way of doing something like this might be:
>
> ###
> RED, WHITE, BLUE = range(3)
> c = RED
> ###

What's enumeration  good for? Can someone give me a few examples when I would 
use enumeration?Years ago, when I was TRYING to learn C, I came across enum, 
but never found out its purpose.


Nicole