Kotlin Interfaces Properties in Interfaces


You can declare properties in interfaces. Since an interface cannot have state you can only declare a property as abstract or by providing default implementation for the accessors.

interface MyInterface {
    val property: Int // abstract

    val propertyWithImplementation: String
        get() = "foo"

    fun foo() {

class Child : MyInterface {
    override val property: Int = 29