I think the only reason to use a sealed class is:
1. you’re on an old version of kotlin that doesn’t support sealed interfaces (I’m so sorry)
2. You need the whole sealed type to subclass a class.
Zach Klippenstein (he/him) [MOD]
04/24/2024, 3:23 PM
If you used a class for children that don’t have parameters, you’d still be allocating a new one every time you need one. But that’s wasteful, because all instances would be identical. So using an object keeps the allocations at 1.