示例#1
0
        static void Main(string[] args)
        {
            //다른 종류의 객체를 생성할 수 있습니다.
            var creator  = new ConcreteCreator();
            var product0 = creator.Create(ProductID.Product);
            var product1 = creator.Create(ProductID.Product1);
            var product2 = creator.Create(ProductID.Product2);
            var product3 = creator.Create(ProductID.Product3);

            product0.print();
            product1.print();
            product2.print();
            product3.print();
        }
示例#2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var factory = new ConcreteCreator();

            var fcn1 = factory.Create(FitFunctionType.Polynomial);

            Console.WriteLine($"fcn1 type of fit is: {fcn1.GetTypeOfFit()}");

            var fcn2 = factory.Create(FitFunctionType.Table);

            Console.WriteLine($"fcn2 type of fit is: {fcn2.GetTypeOfFit()}");

            var fcn3 = factory.Create(FitFunctionType.Table);

            Console.WriteLine($"fcn3 type of fit is: {fcn3.GetTypeOfFit()}");
        }