Skip to content

Instantly share code, notes, and snippets.

@yogacp
Last active August 12, 2019 16:28
Show Gist options
  • Save yogacp/2effcfca4be10ac2a8c4a9bc60edd73a to your computer and use it in GitHub Desktop.
Save yogacp/2effcfca4be10ac2a8c4a9bc60edd73a to your computer and use it in GitHub Desktop.
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