示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("请输入你喜欢的笔记本电脑名称:");
            string   brand = Console.ReadLine();
            NoteBook nb    = CreateNoteBook(brand);

            nb.Show();
            Console.ReadKey();
        }
示例#2
0
        //创建笔记本的工厂
        public static NoteBook CreateNoteBook(string brand)
        {
            NoteBook nb = null;

            switch (brand)
            {
            case "lenovo":
                nb = new Lenovo();
                break;
            }
            return(nb);
        }