示例#1
0
        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());
        }
示例#2
0
        public static IMobileDetail MobileType(string name)
        {
            IMobileDetail value = null;

            if (name == "Nokia")
            {
                value = new Nokia();
            }
            else
            {
                value = new Apple();
            }
            return(value);
        }