/// <summary> /// 接口的定义 /// </summary> public interface IA { void a(); } /// <summary> /// 显式的实现 /// </summary> public class A : IA { public void a() { throw new Exception( "The method or operation is not implemented. "); } } /// <summary> /// 隐式的实现 /// </summary> public class B : IA { void IA.a() { throw new Exception( "The method or operation is not implemented. "); } }
using System ; interface ICanvas { void Paint(); } public class EditBox: ICanvas { public void Paint()//隐式-----1 { Console.WriteLine( "Paint method is called! "); } void ICanvas.Paint()//显示-----2 { Console.WriteLine( "ICanvas.Paint method is called! "); } } class Test { static void Main() { EditBox editbox = new EditBox();
/// <summary> /// 接口的定义 /// </summary> public interface IA { void a(); } /// <summary> /// 显式的实现 /// </summary> public class A : IA { public void a() { throw new Exception( "The method or operation is not implemented. "); } } /// <summary> /// 隐式的实现 /// </summary> public class B : IA { void IA.a() { throw new Exception( "The method or operation is not implemented. "); } }
/// <summary> /// 接口的定义 /// </summary> public interface IA { void a(); } /// <summary> /// 显式的实现 //隐式的实现 /// </summary> public class A : IA { public void a() { throw new Exception( "The method or operation is not implemented. "); } } /// <summary> /// 隐式的实现 //显示的实现 /// </summary> public class B : IA { void IA.a() { throw new Exception( "The method or operation is not implemented. "); } }