enum help

Denis Koroskin 2korden at gmail.com
Wed Aug 27 12:32:26 PDT 2008


On Wed, 27 Aug 2008 23:21:14 +0400, Michael P. <baseball.mjp at gmail.com>  
wrote:

> So, I'm having problems with enums.
>
> Let's say I have this piece of code:
>
> enum Card { NINE = 0, JACK = 2, QUEEN = 3, KING= 4, TEN = 10, ACE = 11 }
> void main()
> {
> Card MyCard;
> MyCard = NINE;
> }
>
> I get an error saying that NINE is undefined and it cannot be implicitly  
> converted to type int. How would I make a Card variable get the value of  
> NINE?


Try this:
> MyCard = Card.NINE;


More information about the Digitalmars-d-learn mailing list