我的类去实现另一个接口,似乎必须把该接口中的方法修饰为Public,否则编译不过.但我的用Reflector反编译.NET3.0中 ContentControl类时,发现它实现了IAddChild接口,但其将该接口中的AddText 与 AddChild方法实现成了 protected virtual void AddChild(object value);与 protected virtual void AddText(string text);为什么它可以使用Protected来修饰这两个方法呢?下面是反编译后的代码(无关部分省略...)
public interface IAddChild
{
    // Methods
    void AddChild(object value);
    void AddText(string text);
}[DefaultProperty("Content"), ContentProperty("Content"), Localizability(LocalizationCategory.None, Readability=Readability.Unreadable)]
public class ContentControl : Control, IAddChild
{
    
    // Methods
    protected virtual void AddChild(object value);
    protected virtual void AddText(string text);    // something else}
  

解决方案 »

  1.   

    有可能他还有一个显示的实现,比如下面的代码是可以编译通过的    internal interface ITest
        {
            void Test();
        }    class B : ITest
        {        protected virtual void Test()
            {
                throw new Exception("The method or operation is not implemented.");
            }
            #region ITest Members        void ITest.Test()
            {
                Test();
            }        #endregion
        }
      

  2.   

    @DemonXHunter 
    Thank you. 的确如此,我验证了...