public IPhone CreatePhone(PhoneNames which) { switch (which) { case PhoneNames.RENO3: Console.WriteLine("Reno3 phone is created in Oppo factory"); return(new Reno3()); case PhoneNames.RENO4: Console.WriteLine("Reno4 phone is created in Oppo factory"); return(new Reno4()); default: throw new ArgumentException("Invalid product", which.ToString()); } }
public IPhone CreatePhone(PhoneNames which) { switch (which) { case PhoneNames.GALAXYFOLD: Console.WriteLine("GalaxyFold phone is created in Samsung Factory"); return(new GalaxyFold()); case PhoneNames.GALAXYFOLDZ: Console.WriteLine("GalaxyFoldZ phone is created in Samsung Factory"); return(new GalaxyFoldZ()); default: throw new ArgumentException("Invalid product", which.ToString()); } }