-
-
Save 5AbhishekSaxena/ab4c00c2d95dd26740163317ec7bdfa6 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
fun main() { | |
val rectangle = Rectangle() | |
rectangle.setHeight(5) | |
rectangle.setWidth(2) | |
val rectangleCheck = rectangle.area() == 10 // true | |
val square: Rectangle = Square() | |
square.setHeight(5) // width is also set to 5 | |
square.setWidth(2) // height is also set to 2 | |
val squareCheck = square.area() == 10 // false - not substitutable | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment