예제 #1
0
        public static void UseFactoryMethod()
        {
            var firstCreator = new FirstCreator();
            var product      = firstCreator.FactoryMethod();

            Console.WriteLine(product.GetType());

            var secondCreator  = new SecondCreator();
            var anotherProduct = secondCreator.FactoryMethod();

            Console.WriteLine(anotherProduct.GetType());
        }
예제 #2
0
        public IProduct CreateProduct()
        {
            var firstCreator = new FirstCreator();

            return(firstCreator.FactoryMethod());
        }