Skip to content

Instantly share code, notes, and snippets.

@ostretsov
Created January 9, 2015 07:50
Show Gist options
  • Save ostretsov/5c033f05b1d09d0af04c to your computer and use it in GitHub Desktop.
Save ostretsov/5c033f05b1d09d0af04c to your computer and use it in GitHub Desktop.
class Rectangle(width: Int, height: Int) {
def getWidth(): Int = width
def getHeight(): Int = height
}
class Square(side: Int) extends Rectangle(side, side)
def area(rectangle: Rectangle): Int = {
rectangle.getHeight() * rectangle.getWidth()
}
val s = new Square(5)
println(area(s))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment