Exemple #1
0
    public override IVeggie GetVeggie(VeggieType veggieType)
    {
        switch (veggieType)
        {
        case VeggieType.Carrot:
            IVeggie carrot = new Carrot();
            return(carrot);

        case VeggieType.Broccoli:
            IVeggie broccoli = new Broccoli();
            return(broccoli);

        case VeggieType.Potato:
            IVeggie potato = new Potato();
            return(potato);
        }
        return(null);
    }
Exemple #2
0
 public override IVeggie GetVeggie(VeggieType veggieType)
 {
     return(null);
 }
 public abstract IVeggie GetVeggie(VeggieType veggieType);
Exemple #4
0
 public bool HasVeggie(VeggieType veggie)
 => _veggies.Contains(veggie);
Exemple #5
0
 public bool CanAddVeggie(VeggieType veggie)
 => !HasVeggie(veggie);