예제 #1
0
        static void Main(string[] args)
        {
            BaseShape shape;

            shape = ShapeFactory.getShape("Square", 5);
            shape.showArea();
            shape = ShapeFactory.getShape("Circle", 2);
            shape.showArea();
            shape = ShapeFactory.getShape("Rectangle", 2, 3);
            shape.showArea();
            shape = ShapeFactory.getShape("Triangle", 3, 4, 5);
            shape.showArea();
        }
예제 #2
0
        static void Main(string[] args)
        {
            double[] A = { 3.0, 4.0, 5.0 };
            Shape    shape;

            shape = ShapeFactory.getShape("Square", A);
            shape.ShowArea();
            shape = ShapeFactory.getShape("Circle", A);
            shape.ShowArea();
            shape = ShapeFactory.getShape("Rectangle", A);
            shape.ShowArea();
            shape = ShapeFactory.getShape("Triangle", A);
            shape.ShowArea();
        }