课程: Programming Foundations: Design Patterns

今天就学习课程吧!

今天就开通帐号,24,100 门业界名师课程任您挑!

Challenge: The Decorator pattern

Challenge: The Decorator pattern

(energetic electronic music) - [Instructor] Let's say you want to start up a pizza store, offering both thick and thin crust pizzas. You'd like to offer a variety of toppings for the pizza that can be combined in any way the customer wants, and you'd like to be able to easily add and remove toppings from the menu over time as you determine what your customers like. You'll need to be able to get a description of the pizza to hand to the chef and a total cost of the pizza to charge the customer for their order. Your challenge is to design a system for the pizza store using the Decorator pattern. Have fun, and feel free to get a snack while you're working on the challenge just in case you're hungry.

内容