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...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
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 spacesWinston 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.
this is supposed to be a surprise, but it smells like a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|