📄 shapes.cs
字号:
public class Square : Shape
{
private int mySide;
public Square(int side, string id) : base(id)
{
mySide = side;
}
public override double Area
{
get
{
// 已知边长,返回正方形的面积:
return mySide * mySide;
}
}
}
public class Circle : Shape
{
private int myRadius;
public Circle(int radius, string id) : base(id)
{
myRadius = radius;
}
public override double Area
{
get
{
// 已知半径,返回圆的面积:
return myRadius * myRadius * System.Math.PI;
}
}
}
public class Rectangle : Shape
{
private int myWidth;
private int myHeight;
public Rectangle(int width, int height, string id) : base(id)
{
myWidth = width;
myHeight = height;
}
public override double Area
{
get
{
// 已知宽度和高度,返回矩形的面积:
return myWidth * myHeight;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -