Java, Design Patterns, Structural Design Pattern, Software Engineering.
latteWithMilk = new MilkDecorator(new Latte()); System.out.println("Ordered: " + latteWithMilk.getDescription() + ", Cost: $" + latteWithMilk.cost()); } } When to Use Decorator Pattern The Decorator Pattern is useful in the following scenarios: When you need to add or modify the behavior of objects