No, you can't do this in Java. Aside from anything else, d
would then presumably be an instance of A
(given the normal idea of "extends"), but users who only knew about A
wouldn't know about it - which defeats the point of an enum being a well-known set of values.
If you could tell us more about how you want to use this, we could potentially suggest alternative solutions.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…