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); }
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); }