static void Main(string[] args) { //Order a Latte with Cream Coffee latteWithCream = new Latte(); latteWithCream = new WhipCream(latteWithCream); Console.WriteLine(latteWithCream.GetDescription() + " at $" + latteWithCream.GetCost()); //Order an Expresso with Caramel and Cream Coffee expressoWithCaramelAndCream = new Expresso(); expressoWithCaramelAndCream = new WhipCream(expressoWithCaramelAndCream); expressoWithCaramelAndCream = new Caramel(expressoWithCaramelAndCream); Console.WriteLine(expressoWithCaramelAndCream.GetDescription() + " at $" + expressoWithCaramelAndCream.GetCost()); }
public static void Main(string[] args) { var coffee = new Cream(new Caramel(new Cappichino())); System.Console.WriteLine(coffee.GetDescription()); System.Console.WriteLine(coffee.Cost()); var coffee1 = new Cream(new Cappichino()); System.Console.WriteLine(coffee1.GetDescription()); System.Console.WriteLine(coffee1.Cost()); var coffee2 = new Cappichino(); System.Console.WriteLine(coffee2.GetDescription()); System.Console.WriteLine(coffee2.Cost()); var coffee3 = new Caramel(new Cappichino()); System.Console.WriteLine(coffee3.GetDescription()); System.Console.WriteLine(coffee3.Cost()); }