-
-
Save hrules6872/b69c89d5b070eb0eb2ecc809f921bd54 to your computer and use it in GitHub Desktop.
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
sealed class State { | |
abstract val baz: Boolean | |
object Loading : State() { | |
override val baz | |
get() = TODO("not implemented") | |
override fun foo(whatever: Boolean) { | |
TODO("not implemented") | |
} | |
} | |
class Error( | |
val errorCode: ErrorCode, | |
override val baz: Boolean | |
) : State() { | |
override fun foo(whatever: Boolean) { | |
TODO("not implemented") | |
} | |
} | |
abstract fun foo(whatever: Boolean) | |
fun bar() = true | |
} | |
enum class ErrorCode(val errorCode: Int) { | |
FTW(500), | |
LOL(404) | |
} | |
// private val stateNotCompile = State() // Sealed types cannot be instantiated !!! | |
private val state = Loading // https://www.youtube.com/watch?v=Ty-IJ3qz-GE :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment