Raised This Month: $ Target: $400
 0% 

enum


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tlc660
Junior Member
Join Date: Jan 2007
Old 01-27-2007 , 07:57   enum
Reply With Quote #1

Code:
enum Test{
    A = 0,
    B = 1,
    C = 2,
    D = 4
}
how to get the enum' value?
i have try Test.A but not working
tlc660 is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 01-27-2007 , 11:16   Re: enum
Reply With Quote #2

Code:
enum Test {     A,     B,     C,     D } new array[Test] server_print("%d", array[C]) // will print 0
[ --<-@ ] Black Rose is offline
tlc660
Junior Member
Join Date: Jan 2007
Old 01-27-2007 , 12:29   Re: enum
Reply With Quote #3

you mean just direct using the member?

that mean i cant have 2 enum with same member name?
like:
Code:
enum testA{
   A,
   B,
   C
}
enum testB{
   C,
   D,
   E
}
tlc660 is offline
schnitzelmaker
Senior Member
Join Date: Apr 2006
Location: HERE
Old 01-27-2007 , 14:10   Re: enum
Reply With Quote #4

Yes and No,enums are global and the Compiler dont know which member you mean.
If you have 2 enums with same member name you need a specific ident to the enum you want.

Here examples what i mean
Code:
e1[testA:C] = 10 e2[testB:C] = 20 console_print(0,"test:%d,%d",e1[testA:C],e2[testB:C])
__________________

Last edited by schnitzelmaker; 01-27-2007 at 14:25.
schnitzelmaker is offline
tlc660
Junior Member
Join Date: Jan 2007
Old 01-28-2007 , 14:48   Re: enum
Reply With Quote #5

thanks schnitzelmaker, also the answer at another enum topic
tlc660 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:15.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode