程序演示通过虚方法 area() 来计算不同形状图像的面积
using System;
namespace PolymorphismApplication
{
class Shape
{
protected int width, height;
public Shape( int a=0, int b=0)
{
width = a;
height = b;
}
public virtual int area()
{
Console
转载
2020-08-14 10:45:39 ·
296 阅读 ·
0 评论