static void Main(string[] args) { Console.WriteLine("enter mobile name"); Console.WriteLine("Enter Father Name"); string result = Console.ReadLine(); IMobileDetail type = MobileInformation.MobileType(result); Console.WriteLine(type.Name()); Console.WriteLine(type.OperatingSystem()); }
public static IMobileDetail MobileType(string name) { IMobileDetail value = null; if (name == "Nokia") { value = new Nokia(); } else { value = new Apple(); } return(value); }