Esempio n. 1
0
        public static dynamic getFactory(MaterialType type)
        {
            IFurnitureAbstractFactory factory = null;

            switch (type)
            {
            case MaterialType.FLASTIC: factory = new PlasticFactory(); break;

            case MaterialType.WOOD: factory = new WoodFactory(); break;

            default: throw new NotImplementedException();
            }
            return(factory);
        }
Esempio n. 2
0
        public static dynamic createFurniture(MaterialType mType, FurnitureType fType)
        {
            IFurnitureAbstractFactory factory = null;

            switch (mType)
            {
            case MaterialType.FLASTIC: factory = new PlasticFactory(); break;

            case MaterialType.WOOD: factory = new WoodFactory(); break;

            default: throw new NotImplementedException();
            }
            dynamic furniture = null;

            switch (fType)
            {
            case FurnitureType.CHAIR: furniture = factory.createChair(); break;

            case FurnitureType.TABLE: furniture = factory.createTable(); break;
            }
            return(furniture);
        }