Daily Archive: 2017-06-05

Kotlin Reference: Interfaces

  Kotlin 中的接口和 Java 8 非常相似,可以拥有抽象方法和方法实现。接口与抽象类的区别在于接口不能储存状态。接口可以具有属性,但属性需要是抽象的,或者仅提供访问器的实现。   使用 interface 关键字声明接口: [code lang=”kotlin”]interface MyInterface { fun bar() fun foo() { // op…
Read more