Created
January 9, 2015 07:50
-
-
Save ostretsov/5c033f05b1d09d0af04c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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