Beispiel #1
0
        static void ConsoleResponse(string input)
        {
            if (input == "1")
            {
                BaoMaCarFrame carFrame = new BaoMaCarFrame();
                VARTA         battery  = new VARTA();
                BaoMaEngine   engine   = new BaoMaEngine();

                carFrame.SetEngine(engine);
                carFrame.SetBattery(battery);

                Console.WriteLine("BaoMa组装完毕");

                BaoMa car = new BaoMa();
                car.StartEngine(carFrame);
            }
            else
            {
                Console.Write("查无此品牌");
            }
        }
Beispiel #2
0
        public void SetBattery(VARTA battery)
        {
            string batteryName = battery.GetName();

            Console.WriteLine(batteryName + "安装到BaoMa车架");
        }