class Program
{
static void Main(string[] args)
{
//使用多态求矩形以及圆形的面积和周长
Shape shape = new Square(3,2);
double area = shape.GetArea();
double perimter = shape.GetPerimter();
Console.WriteLine("这个形状的面积是{0},周长是{1}",area,perimter);
C#使用多态(抽象类)求面积和周长
最新推荐文章于 2022-04-12 09:09:57 发布