Asif Maniar

Software Engineer
posts - 17, comments - 10, trackbacks - 0

My Links

News

Article Categories

Archives

Post Categories

Image Galleries

IIS

Software Architecture

A Simple implementation of the Decorator Design Pattern using C#
The main motivation before the decorator pattern is to be able to add data and behavior to objects dynamically without relying on inheritance. A decorator usually conforms to the interface of the component its decorating. Lets see this with an example. Am building a system that calculates the price of a pizza. I can have many toppings and the total price of the pizza is calculated based on what toppings I pick. One way to do this would be to use inheritance and class hierarchies like Pizza, CheesePizza,...

Posted On Friday, February 10, 2012 4:05 PM | Feedback (0) | Filed Under [ design patterns C# Software Architecture ]

Powered by: