Enum inheritance

Witold Baryluk baryluk at smp.if.uj.edu.pl
Wed Aug 15 11:19:23 PDT 2007


Dnia Wed, 15 Aug 2007 14:13:09 -0400
Matthias Walter <walter at mail.math.uni-magdeburg.de> napisał/a:

> 
> Can I do the following conversion with your code?
> 
> E2 bla = E2.E;
> E3 foo = bla;
> 
no.
you can do:
E1 bla = E1.A;
E3 foo = bla;

Enums in D are really integers, and it will not be so simple to do
what you want. I don't know if opCast can be done with enums.

Mayby such trick:

enum E1 {
    A, B, C
}

enum E2 {
    E = E1.max+1, F, G
}


then it will work.


best regards

-- 
Witold Baryluk
MAIL: baryluk at smp.if.uj.edu.pl, baryluk at mpi.int.pl
JID: movax at jabber.autocom.pl



More information about the Digitalmars-d mailing list