Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Overloading
object Overloading {
def combine(x: Int, y: Int): Int = x + y
def combine(x: String, y: String): String = x + y
def main(args: Array[String]): Unit = {
combine(1, 2)
combine("abc", "xyz")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.