public IProduct GetProduct(int productNumber) { if (productNumber == 1) { return(ProductA.GetProductAInstance()); } else { return(ProductB.GetProductAInstance()); } }
public static Ingrediants GetProduct(string choice) { Ingrediants createdProduct = null; if (choice.Equals("1")) { createdProduct = new ProductA(); } else if (choice.Equals("2")) { createdProduct = new ProductB(); } return(createdProduct); }
public static Ingrediants GetProduct(string choice) { Ingrediants createdProduct = null; if(choice.Equals("1")) { createdProduct = new ProductA(); } else if(choice.Equals("2")) { createdProduct = new ProductB(); } return createdProduct; }
public IProduct GetProductFactory(int productNumber) { IProduct product; if (productNumber <= 3) { product = new ProductA(); } else if (productNumber <= 6) { product = new ProductB(); } else { product = new DefaultProduct(); } return product; }