public static Product Create(ProductType productType)
        {
            Product product = null;

            switch (productType)
            {
                case ProductType.Apple:
                    {
                        product = new AppleProduct();
                        break;
                    }
                case ProductType.Berry:
                    {
                        product = new BerryProduct();
                        break;
                    }
                case ProductType.Cherry:
                    {
                        product = new CherryProduct();
                        break;
                    }
            }

            return product;
        }
示例#2
0
        public static Product Create(ProductType productType)
        {
            Product product = null;

            switch (productType)
            {
            case ProductType.Apple:
            {
                product = new AppleProduct();
                break;
            }

            case ProductType.Berry:
            {
                product = new BerryProduct();
                break;
            }

            case ProductType.Cherry:
            {
                product = new CherryProduct();
                break;
            }
            }

            return(product);
        }