// This method override the parent's method. It first check if the Extra's Description property is equal to Breakfast and then set the appropriate cost.
 public override void ProcessExtra(Extra extra)
 {
     if (extra.Description == "Breakfast")
     {
         extra.Cost = 5;
     }
     else if (extraType != null)
     {
         extraType.ProcessExtra(extra);
     }
 }
 // This method override the parent's method. It first check if the Extra's Description property is equal to No Extra and then set the appropriate cost.
 public override void ProcessExtra(Extra extra)
 {
     if (extra.Description == "No Extra")
     {
         extra.Cost = 0;
     }
     else if (extraType != null)
     {
         extraType.ProcessExtra(extra);
     }
 }
 // This method override the parent's method. It first check if the Extra's Description property is equal to Evening Meal and then set the appropriate cost.
 public override void ProcessExtra(Extra extra)
 {
     if (extra.Description == "Evening Meal")
     {
         extra.Cost = 10;
     }
     else if (extraType != null)
     {
         extraType.ProcessExtra(extra);
     }
 }
Exemple #4
0
 // This abstract method will be override by the child Concrete Handlers to process the Extra object.
 public abstract void ProcessExtra(Extra extra);
Exemple #5
0
 // This method add to the _extraDict dictionary the Extra's Description property as a key and a Extra object as a value.
 public void addExtra(Extra extra)
 {
     _extraDict.Add(extra.Description, extra);
 }