What is the problem with implicit covariant inversion? #6952
Unanswered
zms9110750
asked this question in
Q&A
Replies: 2 comments 4 replies
-
I don't really understand the question. All that code looks legal. What's the problem you're having with it? |
Beta Was this translation helpful? Give feedback.
1 reply
-
We considered, but did not implement, automatic covariant return implementations of interface members. There's a potential for breaking changes where an interface member is reimplemented by a derived type unintentionally, so unlike overriding (which can indeed be covariant), implementation must be invariant and match exactly. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I hava this
Why do I have to take this?
This interface only wants one object.
I gave him a Fight. Fight is a legal object.
Why doesn't he approve?
Similarly, if my parameters (no ref, out) can be implicitly converted to the type required by the interface, what's the problem?
Beta Was this translation helpful? Give feedback.
All reactions