次のコードでは、Shape から Circle クラスを継承しています。
class Shape
{
void Draw();
}
class Circle : Shape
{
}
void Main(string[] args)
{
Shape s = new Shape();
Shape s2 = new Shape();
Circle c = new Circle();
List<Shape> ShapeList = new List<Shape>();
ShapeList.Add(s);
ShapeList.Add(s2);
ShapeList.Add(c);
}
にどのc
ように追加できますShapeList
か?