此接口例程简单明了,因此举例在此 static void Main() ...{ IGElement ge= new CLine(); ge.ID = 1; Console.WriteLine("ID:{0}", ge.ID); ge.Draw(); } using System;namespace Interface...{ /**//// <summary> /// CGElement 的摘要说明。 /// </summary> public interface IGElement ...{ int ID ...{ get; set; } void Draw(); }} using System;using System.Drawing;namespace Interface...{ /**//// <summary> /// CLine 的摘要说明。 /// </summary> public class CLine:IGElement ...{ public CLine() ...{ // // TODO: 在此处添加构造函数逻辑 // } private int m_ID; private PointF m_Begin; private PointF m_End; public int ID ...{ get...{return m_ID;} set...{m_ID =value;} } public void Draw() ...{ Console.WriteLine("绘直线段。"); } }} 转载于:https://blog.51cto.com/cnming/223538