enum with classes/structs

useo useo at start.bg
Thu Mar 10 11:15:25 PST 2011


Hey guys,

is it possible to declare a enum where all entries are instances of a
class (or struct), like the following:

class a {
   ...
   public this(uint i) {
     ...
   }
   ...
}

enum myEnum : a {
   entry1 = new a(0);
   entry2 = new a(1);
}

... or does enumerations only support constant-expressions? Thanks!


More information about the Digitalmars-d-learn mailing list