kotlin interface
snippet in kotlin

kotlin interface

user256

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" 

}