110,570
社区成员
发帖
与我相关
我的任务
分享
public square(double side_length)
{
base.SetLength(side_length);
base.SetLength(side_length);
base.GetLength();
base.GetWideh();
}
public abstract class RectangleBase : Graph
{
#region Properties
public abstract double Length
{
get;
set;
}
public abstract double Width
{
get;
set;
}
#endregion
#region Graph Members
public override double CalculateArea()
{
return Length * Width;
}
#endregion
}
public class Rectangle : RectangleBase
{
#region Fields
private double length;
private double width;
#endregion
#region Constructors
public Rectangle()
: this(0, 0)
{
}
public Rectangle(double _length, double _width)
{
length = _length;
width = _width;
}
#endregion
#region RectangleBase Members
public override double Length
{
get
{
return this.length;
}
set
{
this.length = value;
}
}
public override double Width
{
get
{
return this.length;
}
set
{
this.length = value;
}
}
#endregion
}
public class Square : RectangleBase
{
#region Fields
private double side;
#endregion
#region Constructors
public Square()
: this(0)
{
}
public Square(double side)
{
this.side = side;
}
#endregion
#region RectangleBase Members
public override double Length
{
get
{
return this.side;
}
set
{
this.side = value;
}
}
public override double Width
{
get
{
return this.side;
}
set
{
this.side = value;
}
}
#endregion
}