Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created May 25, 2011 16:37
Show Gist options
  • Save kmizu/991315 to your computer and use it in GitHub Desktop.
Save kmizu/991315 to your computer and use it in GitHub Desktop.
overloading in package object
import foo._
object A {
def main(args: Array[String]) {
println(plus(1))
println(plus(1, 3))
}
}
//scalac package.scala
//scalac A.scala
//scala A
package object foo {
def plus(x: Int):Int = x + 1
def plus(x: Int, inc: Int):Int = x + inc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment