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
and promote it a
by adding some values to it.
10/02/2019, 11:42 PM
I have a similar problem, and because some reflection was already being done I decided to just use more reflection