sclass Alt { byte which; O value; bool isA() { ret which == 1; } bool isB() { ret which == 2; } A a() { if (which != 1) _failMe(); ret (A) value; } B b() { if (which != 2) _failMe(); ret (B) value; } void _failMe { fail("Alt object is of wrong type: " + shortClassName(value)); } }