Example #1
0
        static void Main(string[] args)
        {
            Rectangle[] rectangles = new Rectangle[] {
                new Rectangle {
                    Width = 10, Height = 20
                },
                new Rectangle {
                    Width = 20, Height = 10
                }
            };

            RectanglesAreaCalculator.Area(rectangles);


            object[] shapes = new object[] {
                new Rectangle {
                    Width = 10, Height = 20
                },
                new Circle {
                    Radius = 20
                }
            };

            ShapesAreaCalculator.Area(shapes);
        }
Example #2
0
        static void Main(string[] args)
        {
            IShape[] shapes = new IShape[] {
                new Rectangle {
                    Width = 10, Height = 20
                },
                new Circle {
                    Radius = 20
                }
            };

            ShapesAreaCalculator areaCalc = new ShapesAreaCalculator();
            double totalArea = areaCalc.Area(shapes);
        }