Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("請輸入你要的品牌");
            string   Brand = Console.ReadLine();
            NoteBook nb    = GetBrandclass.GetBrand(Brand);

            nb.GetNotebook();
        }
Esempio n. 2
0
        public static NoteBook GetBrand(string brand)
        {
            NoteBook nb = null;

            switch (brand)
            {
            case "Acer":
                nb = new Acer();
                break;

            case "Asus":
                nb = new Asus();
                break;

            case "HP":
                nb = new HP();
                break;

            case "Apple":
                nb = new Apple();
                break;
            }
            return(nb);
        }