Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("请输入你想要的笔记本");
            string   brand = Console.ReadLine();
            NoteBook nb    = GetNoteBook(brand);

            if (nb != null)
            {
                nb.SayHello();
            }
            else
            {
                Console.WriteLine("没有你想要的笔记本");
            }
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("请输入你想要的笔记本品牌");
            string brand = Console.ReadLine();
            //整个简单工厂的核心   工厂
            //根据用户的输入 返回相应的笔记本 父类
            NoteBook nb = GetNoteBook(brand);

            if (nb != null)
            {
                nb.SayHello();
            }
            else
            {
                Console.WriteLine("没有你想要的电脑品牌!!!!");
            }
            Console.ReadKey();
        }