static void Main(string[] args) { Beverage bebida = new PayuEspresso(1); Console.WriteLine(bebida.getDescription() + " $" + bebida.getCost()); bebida = new SoyMilk(bebida); Console.WriteLine(bebida.getDescription() + " $" + bebida.getCost()); bebida = new Sugar(bebida); Console.WriteLine(bebida.getDescription() + " $" + bebida.getCost()); bebida = new EspressoShot(bebida); Console.WriteLine(bebida.getDescription() + " $" + bebida.getCost()); Console.ReadKey(); }
public static void Main(string[] args) { Coffee c = new SimpleCoffee(); Console.WriteLine("Cost: " + c.getCost() + ";"); c = new Milk(c); Console.WriteLine("Cost: " + c.getCost() + ";"); c = new Sugar(c); Console.WriteLine("Cost: " + c.getCost() + ";"); c = new SimpleCoffee(); c = new Milk(new Sugar(c)); //shows the actual decoration Console.WriteLine("Cost: " + c.getCost() + ";"); }