Esempio n. 1
0
        static void Main(string[] args)
        {
            Rectangle rect1 = new Rectangle();

            rect1.Width  = 24.00;
            rect1.Height = 8.00;

            Elipse elipse1 = new Elipse();

            elipse1.Width  = 24.00;
            elipse1.Height = 8.00;

            object[] allTheRectangles = new object[2] {
                rect1, elipse1
            };

            Console.WriteLine(string.Join(",", AreaCalculator.Area(allTheRectangles)));
        }
        static void Main(string[] args)
        {
            Shape shape1 = new Rectangle();

            shape1.Width  = 24.00;
            shape1.Height = 8.00;

            Shape square1 = new Square();

            square1.Width  = 24.00;
            square1.Height = 12.00;

            Shape[] allTheRectangles = new Shape[2] {
                shape1, square1
            };

            Console.WriteLine(string.Join("\n", AreaCalculator.Area(allTheRectangles)));
        }