Skip to content

Instantly share code, notes, and snippets.

Created February 10, 2012 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/1791986 to your computer and use it in GitHub Desktop.
Save anonymous/1791986 to your computer and use it in GitHub Desktop.
// the solution
// 1. declare the class Number(Int)
// 2. define method Number.inc(): Number
// 3. define method Number.dec(): Number
// 4. define getNumber():Int
class Number(var n : Int) {
def inc(): Number = {
n + 1
}
def dec(): Number = {
n - 1
}
def getNumber() : Int = {
return n
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment