I think you're making this more complex than it needs to be. I'm just trying to create a scenario where you're passing a generic function (getWeight) to a non-generic method (SumWeights).
Currently developing futuristic smart-device, IoT connected, highway construction site safety system in EU.
Used to work on infrastructure, application architecture and cloud engineering.
I think you're making this more complex than it needs to be. I'm just trying to create a scenario where you're passing a generic function (
getWeight
) to a non-generic method (SumWeights
).Are you talking about IoC / DI? ;)
Edit: Now I remember! Your solution reminds me of Service locator pattern, which is BTW an anti-pattern. That's why I found it immediately wrong.