Exemplo n.º 1
0
        public override FactoryDataItem GetData(int type)
        {
            FactoryDataItem factoryDataItem = null;

            switch ((ColorType)type)
            {
            case ColorType.Red:
                factoryDataItem = new FactoryDataItem(new Red());
                break;

            case ColorType.Blue:
                factoryDataItem = new FactoryDataItem(new Blue());
                break;

            case ColorType.Green:
                factoryDataItem = new FactoryDataItem(new Green());
                break;
            }

            return(factoryDataItem);
        }
Exemplo n.º 2
0
        public override FactoryDataItem GetData(int type)
        {
            FactoryDataItem factoryDataItem = null;

            switch ((ShapeType)type)
            {
            case ShapeType.Circle:
                factoryDataItem = new FactoryDataItem(new Circle());
                break;

            case ShapeType.Square:
                factoryDataItem = new FactoryDataItem(new Square());
                break;

            case ShapeType.Rectangle:
                factoryDataItem = new FactoryDataItem(new Rectangle());
                break;
            }

            return(factoryDataItem);
        }