日期:2014-05-19  浏览次数:20950 次

一个小问题,解决马上结帐,在线等...
using   System;
using   System.Drawing;

namespace   _05_01
{
///   <summary>
///   Shapes   的摘要说明。
///   </summary>
public   abstract   class   shape
{
protected   Point   position;
protected   Color   color;
protected   float   linewidth;
protected   string   name;
public   string   Name
{
get  
{
return   name;
}
set  
{
name=value;
}
}
public   Point   Position//shape定位点
{
get
{
return   position;
}
set  
{
position=value;
}
}
public   Color   Colro//shape颜色
{
get
{
return   color;
}
set  
{
color=value;
}
}
public   float   Linewidth
{
get
{
return   linewidth;
}
set  
{
linewidth=value;
}
}
public   abstract   double   Area{get;}//面积
public   abstract   void   Draw(Graphics   g);//画自己的方法

}


public   class   Ellipse:shape//椭圆
{
//protected   int   semiMajorAxis/*长半轴*/,semiMinorAxis;/*短半轴*/


}
}


编辑出错提示:
E:\05-01\Shapes.cs(65):   “_05_01.Ellipse”不会实现继承的抽象成员“_05_01.shape.Area.get”

E:\05-01\Shapes.cs(65):   “_05_01.Ellipse”不会实现继承的抽象成员“_05_01.shape.Draw(System.Drawing.Graphics)”



------解决方案--------------------
在Ellipse实现这两个方法
------解决方案--------------------
重载一遍!!!!!!!

public class Ellipse:shape//椭圆
{
//protected int semiMajorAxis/*长半轴*/,semiMinorAxis;/*短半轴*/
public override double Area
{
get
{
return 0;
}
}
public override void Draw(Graphics g)
{
//... 具体代码..
}
}