Last active
February 22, 2018 23:07
-
-
Save KucherenkoIhor/4684d20fdeb8751ec6aff92fda76e2bd 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
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