Пример #1
0
        static void Main(string[] args)
        {
            TwoDimShape[] myShapes = new TwoDimShape[3];
            myShapes[0] = new Rectangle(10, 5);
            myShapes[1] = new Triangle(12, 6);
            myShapes[2] = new Circle(8);

            foreach (TwoDimShape tds in myShapes)
            {
                ProcessShape(tds);
                Console.WriteLine("");
            }
        }
Пример #2
0
 // static method processShape
 public static void ProcessShape(TwoDimShape obj)
 {
     Console.Write($"Area = {obj.Area()}");
 }