Kotlin Basic Interface


Example

A Kotlin interface contains declarations of abstract methods, and default method implementations although they cannot store state.

interface MyInterface {
    fun bar()
}

This interface can now be implemented by a class as follows:

class Child : MyInterface {
   override fun bar() {
       print("bar() was called")
   }
}