static void Main()
        {
            var circle = new Circle(4.0f);
            Console.WriteLine("Area of a circle with a 4.0 radius is {0}", circle.GetArea());

            var rectangle = new Rectangle(7.0, 2.0);
            Console.WriteLine("Area of a rectangle with 7.0 Height and 2.0 Width is {0}", rectangle.GetArea());

            var equilateralTriangle = new EquilateralTriangle(4.5);
            Console.WriteLine("Area of an equilateral triangle with a 4.5 long side is {0}", equilateralTriangle.GetArea());

            var square = new Square(5.0);
            Console.WriteLine("Area of a square with 5.0 long sides is {0}", square.GetArea());

            Console.ReadKey();
        }
        static void Main()
        {
            Shape[] someShapes = new Shape[6];
            someShapes[0] = new Rectangle(5, 6);
            someShapes[1] = new Triangle(5, 6);
            someShapes[2] = new Circle(4);
            someShapes[3] = new Triangle(11, 7);
            someShapes[4] = new Rectangle(5, 6);
            someShapes[5] = new Circle(15);

            foreach (Shape shape in someShapes)
            {
                Console.WriteLine("Shape type: {0} \nSurface: {1}", shape.GetType(), shape.CalculateSurface());
                Console.WriteLine();
            }
        }
示例#3
0
 public Circle(Circle circle)
 {
     this.Initialize(circle.origin, circle.radius);
 }