Esempio n. 1
0
 static void Main()
 {
     Console.OutputEncoding = Encoding.Unicode;
     Triangle triangle = new Triangle(5.6, 2.3);
     Rectengle rect = new Rectengle(5, 2);
     Square sqrt = new Square(2.5);
     Shape[] forms = new Shape[] { triangle, rect, sqrt };
     foreach (var shape in forms)
     {
         Console.WriteLine("{0} with has surface {1}cm\u00B2", shape.GetType().Name ,shape.CalculateSurface());
     }
 }
Esempio n. 2
0
        static void Main()
        {
            Console.OutputEncoding = Encoding.Unicode;
            Triangle  triangle = new Triangle(5.6, 2.3);
            Rectengle rect     = new Rectengle(5, 2);
            Square    sqrt     = new Square(2.5);

            Shape[] forms = new Shape[] { triangle, rect, sqrt };
            foreach (var shape in forms)
            {
                Console.WriteLine("{0} with has surface {1}cm\u00B2", shape.GetType().Name, shape.CalculateSurface());
            }
        }