I have a pretty big hierarchy of sealed classes wh...
# announcements
t
I have a pretty big hierarchy of sealed classes where all the leafs are data classes. Basically every subclass is just the superclass plus some extra values. Sometimes the subclasses are even identical except for the name, which signifies a different kind of the object. How can I construct values of this class hierarchy without having lots of code duplication? Delegation is hardly possible, since the common superclasses are sealed and thus can't be extended to make delegate objects for them. Basically what I want to do is to have one function that makes `Car`s and then take that
Car
and promote it a
BMW
or
Toyota
by adding some values to it.
k
I have a similar problem, and because some reflection was already being done I decided to just use more reflection
k
There is this relevant issue: https://youtrack.jetbrains.com/issue/KT-15471