Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created March 28, 2015 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/de8642b552d07fef1a0b to your computer and use it in GitHub Desktop.
Save shigemk2/de8642b552d07fef1a0b to your computer and use it in GitHub Desktop.
class A {
def add(x: Int, y: Int): Int = {
x + y
}
}
val a = new A()
println(a.add(1, 2))
class B extends A {
override def add(x: Int, y: Int): Int = {
x + y + 2
}
}
val b = new B()
println(b.add(1, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment