Created
August 7, 2020 06:37
-
-
Save husen-hn/576dbe241191c6d313842c744b597aac 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 MyValue(default: String) { | |
open val value: String = default | |
class Immutable(default: String): MyValue(default) { | |
fun mutate(): Mutable = Mutable(value) | |
} | |
class Mutable(default: String) : MyValue(default) { | |
fun immutate(): Immutable = Immutable(value) | |
override var value = default | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment