示例#1
0
        private void Start()
        {
            // 创建一个华硕工厂
            AbstractFactory asusFactory = AbstractFactory.CreateFactory(FactoryType.Asus);
            // 创建一个华硕鼠标
            IMouse mouse1 = asusFactory.CreateMouse();

            mouse1.Print();

            // 创建一个戴尔工厂
            AbstractFactory dellFactory = AbstractFactory.CreateFactory(FactoryType.Dell);
            // 创建一个戴尔鼠标
            IMouse mouse2 = dellFactory.CreateMouse();

            mouse2.Print();
        }