Let us consider a PIZZA class which has a method that displays the message “Pizza”. A PIZZA object may be decorated by 3 kinds of toppings. OLIVE class has a method that displays the message “With Olive”. PEPPER class has a method that displays the message “With Pepper”. MASHROOM class has a method that displays the message “With Mashroom”. We would like to use the decorator pattern to create pizzas with toppings.
-
Notifications
You must be signed in to change notification settings - Fork 0
To use the decorator pattern for a pizza with toppings, I created a Pizza base class with a method to display "Pizza". Then, create decorator classes for each topping (Olive, Pepper, Mashroom), each extending Pizza. These classes would override the display method to include their specific topping message.
ParisaArbab/Decorator-Pattern--Pizza
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
To use the decorator pattern for a pizza with toppings, I created a Pizza base class with a method to display "Pizza". Then, create decorator classes for each topping (Olive, Pepper, Mashroom), each extending Pizza. These classes would override the display method to include their specific topping message.
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published