Maybe delegation? `class Impl1(impl2: Impl2) : Som...
# announcements
d
Maybe delegation?
class Impl1(impl2: Impl2) : SomeInterface by impl2
u
Thanks for suggestion. The problem is that I initialize some heavy object in init{} of the first implementation, I would like to replace this process by initialization of some other object in second implementation.
d
You should maybe extract the common parts of
Impl1
and
Impl2
into a common abstract base class, which both then extend.
u
I’ve just tried. Seems to be exactly what I need. Thanks a lot, @diesieben07. 👍