enum constructors (creating members of members)
问题 In D, I'm trying to create an enum whose members have members. I can better explain what I'm trying to do with an example, where s and i stand in for the sub-members I'm trying to create: In Python, I can do this: class Foo(enum.Enum): A = "A string", 0 B = "B string", 1 C = "C string", 2 def __init__(self, s, i): self.s = s self.i = i print(Foo.A.s) Java can do something like this: public enum Foo { A("A string", 0), B("B string", 1), C("C string", 2); private final String s; private final