Why can't I have protected interface members?

后端 未结 13 1894
走了就别回头了
走了就别回头了 2020-11-29 19:58

What is the argument against declaring protected-access members on interfaces? This, for example, is invalid:

public interface IOrange
{
    public OrangePee         


        
13条回答
  •  执笔经年
    2020-11-29 20:11

    By implementing an interface the type states that it supports a specific set of methods. If any of these methods were not public, it would not be available to callers and thus the type would not support the interface as stated.

提交回复
热议问题