Example #1
0
        static void Main(string[] args)
        {
            PlainPizza pizza = new PlainPizza();

            Console.WriteLine("Plain Pizza: " + pizza.GetPrice().ToString());

            HamDecorator moreHam     = new HamDecorator(pizza);
            HamDecorator someMoreHam = new HamDecorator(moreHam);

            Console.WriteLine("Plain Pizza with double extra Ham: " + someMoreHam.GetPrice().ToString());

            BaconDecorator moreBacon = new BaconDecorator(someMoreHam);

            Console.WriteLine("Plain Pizza with double extra Ham with Bacon: " + moreBacon.GetPrice().ToString());

            PepperoniDecorator morePepperoni = new PepperoniDecorator(moreBacon);

            Console.WriteLine("Plain Pizza with double extra Ham with Bacon with Pepperoni: " + morePepperoni.GetPrice().ToString());

            Console.ReadLine();
        }
Example #2
0
 public BaconDecorator(HamDecorator pizzaToDecorate)
     : base(pizzaToDecorate)
 {
     this.myPrice = 0.99;
 }