Exploring Sealed Class vs Enum in Kotlin Which is Best for Your Code?
Sealed classes are a bit like having a magical box that can hold different kinds of things, not just crayons. Inside this box, you can have crayons of different colors, but you can also have stickers and even small toys. Each thing in the box might look different and do different stuff. So, sealed classes let you have a special box where you can keep crayons and more, and each thing inside can be special and have its own abilities.