Skip to content

Instantly share code, notes, and snippets.

@KucherenkoIhor
Last active February 22, 2018 23:07
Show Gist options
  • Save KucherenkoIhor/4684d20fdeb8751ec6aff92fda76e2bd to your computer and use it in GitHub Desktop.
Save KucherenkoIhor/4684d20fdeb8751ec6aff92fda76e2bd to your computer and use it in GitHub Desktop.
interface Nameable {
var name: String
}
class JackName : Nameable {
override var name: String = "Jack"
}
class LongDistanceRunner: Runnable {
override fun run() {
println("long")
}
}
class Person(name: Nameable, runner: Runnable): Nameable by name, Runnable by runner
fun main(args: Array<String>) {
val person = Person(JackName(), LongDistanceRunner())
println(person.name) //Jack
person.run() //long
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment