Can I delegate an interface to two implementations...
# random
e
Can I delegate an interface to two implementations? Assume:
Copy code
interface Tomte 

class TomteImplA: Tomte 
class TomteImplB: Tomte
Something like
class CombinedTomte: Tomte by TomteImplA() && TomteImplB()
I know I could manually call the two implementations, but wonder if I can do it automagically
y
What's your expected behaviour if any of the methods need to return something? Should it do a call to the first, then use the second result, or vice versa? Should it combine the results somehow? I think it's likely smarter to define your own combined class, and then delegate to that.
e
That's a fair point. In this case they are all
Unit
, so it would make sense, but in the general case it's ambiguous.