
Untitled
By: a guest on
Jul 15th, 2012 | syntax:
None | size: 0.76 KB | hits: 13 | expires: Never
Extend and enumeration constant
private enum Mode{
FRIGHTENED, BLINKING extends FRIGHTENED, SCATTER
}
switch (some_mode){
case FRIGHTENED:
// This would trigger when the actual "some_mode" is set
// to FRIGHTENED or BLINKING
break;
case BLINKING:
// This would only trigger if the actual "some_mode" is set to BLINKING
}
if (some_mode == Mode.FRIGHTENED){
// The behavior in FRIGHTENED and BLINKING mode is the same. The only
// difference is the way they are visualized.
}
switch (some_mode){
case BLINKING:
// This would only trigger if the actual "some_mode" is set to BLINKING
// no break statement!
case FRIGHTENED:
// This would trigger when the actual "some_mode" is set
// to FRIGHTENED or BLINKING
}