useo: > is it possible to declare a enum where all entries are instances of a > class (or struct), like the following:
I don't think so. Enums are compile-time constants.
This code doesn't compile:
class A {
this(uint i) {}
}
enum myEnum : A {
entry1 = new A(0),
entry2 = new A(1)
}
void main() {}
It's important to understand that in D OOP and procedural/C-style features are
often separated. typedef didn't work well with OOP. Don't mix things that are
not meant to be mixed.
Bye,
bearophile
