哪位大神看看哪错了
class Program{
public class shap
{
public double area;
public virtual double Area(double S)
{
this.area = S;
return S;
}
public double ShowArea()
{
Console.WriteLine("面积为{0}", area);
return area;
}
public virtual double Area()
{
return area;
}
public shap(double d)
{
area = d;
}
}
public class circle : shap //子类
{
double radius;
public const double PI = 3.1416;
public circle(double S, double R) //继承
: base(S)
{
this.area=S;
this.radius = R;
}
public override double Area()
{
double area = PI * radius * radius;
//return Console.ReadLine(area);
return area;
}
}
public class rectangle : shap //子类
{
double length;
double width;
public rectangle(double S, double L, double W) //继承
: base(S)
{
this.area = S;
this.length = L;
this.width = W;
}
public override double Area() //重写
{
double area = length * width;
//return Console.WriteLine(area);
return area;
}
}
static void Main(string[] args)
{
//circle S1 = new circle(" ", 4);//
circle S1 = new circle(2, 4);
S1.Area();
//rectangle S2 = new rectangle(" ", 4, 6);
rectangle S2 = new rectangle(0, 4, 6);
S2.Area();
Console.ReadKey();
}
}
}