3 ms·
I suppose if you were so unfortunate as to have two interfaces name the same function with different expectations on what it does, you'd end up having to use an
by knome 2y ago
I suppose if you were so unfortunate as to have two interfaces name the same function with different expectations on what it does, you'd end up having to use an intermediate object to wrap around your base one, to ensure it matches the required interface, possibly adding a helper to wrap the current object for convenience at callsites.
In C#, you would instead define a method and specify the name of the interface in order to override the method it receives to be different from the base method that is experiencing the conflict.
I know this is a real issue, but I don't think this is excessively common for either language.
And the real answer for both would be to rename/prefix the names in the interfaces so that they aren't conflicting in the first place, if you have the ability to do so :-)
There are certainly always trade offs when building something.