예제 #1
0
        public override void AddTopping(ToppingsList topping)
        {
            switch (topping)
            {
            case ToppingsList.Sugar:
                Toppings.Add(new Sugar());
                break;

            case ToppingsList.Milk:
            case ToppingsList.Chocolate:
                throw new InvalidOperationException($"Illegal topping for {Description}: {topping}");

            default:
                throw new InvalidOperationException($"Unknown topping: {topping}");
            }
        }
예제 #2
0
        private string GenerateDesciption()
        {
            string description = Size + " Inch pizza " + Crust + " ";

            if (Toppings != null && ToppingsList.Count() > 0)
            {
                description += "with toppings: ";

                description += String.Join(", ", ToppingsList);
            }

            if (Cheese)
            {
                description += " with cheese";
            }
            else
            {
                description += " without cheese";
            }

            description += " and " + Sauce + " sauce.";

            return(description);
        }
예제 #3
0
 public abstract void AddTopping(ToppingsList topping);
예제 #4
0
파일: Pizza.cs 프로젝트: marinovdev/C-OOP
 public void AddTopping(Topping topping)
 {
     ToppingsList.Add(topping);
 }
예제 #5
0
 protected virtual void AddTopping(decimal p, int i, APizzaComponent apc)
 {
     ToppingsList.Add(new Topping(this, p, i, apc));
 }
예제 #6
0
 protected virtual void AddTopping(decimal p, int i, string n, ItemType t)
 {
     ToppingsList.Add(new Topping(this, p, i, n, t));
 }
예제 #7
0
 protected virtual void AddTopping(string type, decimal price)
 {
     ToppingsList.Add(new Topping(type, price));
 }