Koltin, Sealed Classes In Kotlin, Android.
can hold. sealed class Result { data class Success(val data: String) : Result() data class Error(val message: String) : Result() } Problem Solved: Unforeseen Subtypes and Runtime Type Checks Traditional class hierarchies can lead to runtime exceptions if new subclasses are inadvertently introduced