Christian Heupel wrote:
The main issue I'm having with this is that both the "sender" and "receiver" inherit from the same (abstract) parent. When I want to use composition for a class that represents "both functionalities", I am forced to create redundant code. As an Example:
If you want to use composition to create a "MultipicationAndDivisionCalculator", you will have to implement "add" and "subtract" two times, one of which will never be used.
Christian Heupel wrote:I would need a Calculator for every SuperType possible then...
Christian Heupel wrote:Don't forget that I am using generics in my original example.
I’ve done that. It might make it worse, since the original code mixes tabs and spaces
Winston Gutkowski wrote: . . . PS: If you could break up some those enormous lines in your code, it would make everything a lot easier to read. Thanks.