interfaces kotlin code example
Example: kotlin interface
fun main() {
Child().hairColour() /// brown
Child().eyeColour() /// blue
}
interface Parent {
val eyeColour: String
get() = "blue"
val hairColour: String
get() = "black"
fun eyeColour() {
println(eyeColour)
}
fun hairColour() {
println(hairColour)
}
}
class Child : Parent {
override val hairColour = "brown"
}