Basic Interface

suggest change

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")
   }
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents