Kotlin interface:- Geniusofstudent


Interfaces

Interfaces in Kotlin are very similar to Java 8.
An interface is defined using the keyword interface
interface MyInterface {
    fun bar()
    fun foo() {
    // optional body
    }
    }
Implementing Interfaces
A class or object can implement one or more interfaces
class Child : MyInterface {
    override fun bar() {
    // body
    }
    }
Kotlin interface:- Geniusofstudent Kotlin interface:- Geniusofstudent Reviewed by Network security on June 13, 2019 Rating: 5

No comments:

Useful Information

Powered by Blogger.