我們有一些代碼,看起來大致是這樣的: // Two enums that differ entirely.
enum A { a1, a2 };
enum B { b1, b2 };
// Functions to convert in some meaningful way between them
A convert(B);
B convert(A);
現在,我們的編譯器去和不
我有一個這樣的枚舉類: public enum Position {
A1(0,0),
A2(1,0),
//etc
public final int dy, dx;
private Position(int dy, int dx) {
this.dy = dy;
this.dx = dx;
}
}
現在