Last active
April 2, 2023 13:55
-
-
Save renaudcerrato/d7f23888499e6d84de1f6897d427d880 to your computer and use it in GitHub Desktop.
Kotlin Interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface A { | |
val a: Int // abstract | |
val b: Int // abstract | |
fun foo() // abstract | |
fun bar() { | |
// optionnal body | |
} | |
} | |
interface B { ... } | |
class C: A, B { | |
override val a: Int = 42 | |
override val b: Int | |
get() = a + 1 | |
override foo() { ... } | |
override bar() { ... } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment