Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please allow non-public members to implicitly implement non-public interfaces #16089

Closed
alrz opened this issue Dec 23, 2016 · 5 comments
Closed

Comments

@alrz
Copy link
Member

alrz commented Dec 23, 2016

internal interface I
{
  void M();
}

public class C : I
{
  protected internal virtual void M() {}
}

In other words, M must not be less accessible than I rather than required to be public.

Currently the workaround is to explicitly implement I to delegate corresponding non-public members.

Q: Should the accessibility of C also be taken into account?

@bondsbw
Copy link

bondsbw commented Dec 23, 2016

Related: #3599

@alrz
Copy link
Member Author

alrz commented Dec 23, 2016

@bondsbw

"Allow implicit implementation of internal interfaces" This is currently possible and the example suggests to add internal modifier on interface members which doesn't add up. I think that's a little misleading.

@bondsbw
Copy link

bondsbw commented Dec 23, 2016

Agreed, the issue name is misleading.

But unless I'm misunderstanding one of the proposals, they are substantially the same. Though I believe yours goes a bit further in allowing protected internal instead of just internal.

@alrz
Copy link
Member Author

alrz commented Dec 25, 2016

@gafter I'd appreciate it if you could clarify if there is anything wrong with the suggestion. Thanks!

@gafter
Copy link
Member

gafter commented Dec 25, 2016

@alrz I don't think this would be a bad idea necessarily, but it has marginal value compared to many other things we could do. If you think of any proposal as starting with -100 or -1000 points, it is hard to see how the value added rises above that.

@alrz alrz closed this as completed Mar 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants