Skip to content

[Proposal] Support generic parameters as covariant return types in overrides #9098

Closed Answered by ufcpp
just-ero asked this question in Language Ideas
Discussion options

You must be logged in to vote
interface I;

abstract class A
{
    public abstract I M();
}

class B<T> : A
  where T : class, I // T must be a reference type
{
    public override T M() { throw null; }
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@just-ero
Comment options

@ufcpp
Comment options

Answer selected by just-ero
@just-ero
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants