Skip to content

Instantly share code, notes, and snippets.

@jbaruch
Created May 30, 2013 20:18
Show Gist options
  • Save jbaruch/5680824 to your computer and use it in GitHub Desktop.
Save jbaruch/5680824 to your computer and use it in GitHub Desktop.
class ThridPartyCoolApi {
enum Number {
one(1), two(2), three(3)
int value
Number(int value) {
this.value = value
}
int getValue() {
return value;
}
}
static int plus(Number first, Number second) {
first.value + second.value
}
}
//so far so good:
assert ThridPartyCoolApi.plus(ThridPartyCoolApi.Number.one, ThridPartyCoolApi.Number.two) == 3
//guess what, number four also exists!
// I want the following to work:
assert ThridPartyCoolApi.plus(ThridPartyCoolApi.Number.four, ThridPartyCoolApi.Number.two) == 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment