Enumerations
Posted
#1
(In Topic #994)
Trainee
Is there a construct in Gambas like Enumerations (as known as in Java or C++)? Or should I define a class with constants to emulate that?
Thanks
Witchi
Posted
Guru

Witchi said
Hi,
Is there a construct in Gambas like Enumerations (as known as in Java or C++)? Or should I define a class with constants to emulate that?
Thanks
Witchi
absolutely Anything can be made into an array and enumerated
Just like this for an example object called MyObject
Code (gambas)
Posted
Guru

Posted
Guru

cogier said
I can't get Bruce's code to work. This is a little simpler if it helps.
Well it wasn't really code it was an example. you'd have to make a MyObject.class and give it Data1/Data2 properties
But your code is as good as any.
Here's some other ways to enumerate.
see /comp/gb/enum - Gambas Documentation for how to make your own class have enumeration.
Or do you mean declaring constant variables that increase in number? that sort of Enum?
You can do that too.
See here
/lang/enumdecl - Gambas Documentation
or…
Posted
Trainee
BruceSteers said
Or do you mean declaring constant variables that increase in number? that sort of Enum?
You can do that too.
See here
/lang/enumdecl - Gambas Documentation
or…
Thanks, this is the thing I'm looking for.
Witchi
1 guest and 0 members have just viewed this.




</IMG>