Last active
August 12, 2019 16:28
-
-
Save yogacp/2effcfca4be10ac2a8c4a9bc60edd73a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
interface Toy { | |
var color: String? | |
} | |
open class FlyingToy : Toy { | |
override var color: String? = "Red" | |
open fun fly() { | |
println("The toy is flying...") | |
} | |
} | |
open class LandToy : Toy { | |
override var color: String? = "Black" | |
open fun move() { | |
println("The toy is moving...") | |
} | |
} | |
class Plane : FlyingToy() { | |
override fun fly() { | |
super.fly() | |
println("The toy is flying...") | |
} | |
} | |
class Car : LandToy() { | |
override fun move() { | |
super.move() | |
println("The toy is moving...") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment