Never miss a beat

Join my newsletter.

Tag: sealed classes

Kotlin Sealed Classes

Published: 10/19/2018

Kotlin has a concept known as sealed hierarchies (several other languages implement this feature as well). In Kotlin, we can generate a sealed hierarchy through the use of sealed classes. What are Sealed Classes? Sealed classes are basically an extension to an enum class. They offer similar functionality with a few key differences. Similarly: The class can not be instantiated directly The type can be represented as a type from a limited set, but not from any type outside of the set. Differences…