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()); }
public IProduct CreateProduct() { var firstCreator = new FirstCreator(); return(firstCreator.FactoryMethod()); }