What is the correct way of delegating when you hav...
# codingconventions
a
What is the correct way of delegating when you have a composite interface? To give an example:
Copy code
interface A
interface B
class ABImpl(concreteA: A): A by concreteA, B
now say I want a composite interface instead that encapsulates A & B
Copy code
interface ABComposite: A, B
Then my ABImpl becomes
Copy code
class ABImpl: ABComposite
If I want to delegate A only, but not B my solution was to do
Copy code
class ABImpl(concreteA: A): ABComposite, A by concreteA
Is that the correct way? It just looks slightly odd, but if that’s how you do it all good đŸ™‚
d
Should probably just not use the composite interface if you have the option
m
Copy code
interface A
interface B
class ConcreteAB: A, B

class C(concreteAB: ConcreteAB): A by concreteAB, B by concreteAB