Exemplo n.º 1
0
 public ChocolateAdapter(IDrink drink) : base(drink)
 {
     chocolate = new HotChocolate();
     Price     = chocolate.Cost();
     Name      = chocolate.GetNameOfDrink();
     //deluxe is just as expensive as regular?
 }
Exemplo n.º 2
0
        public ChocolateDrinkDecorator(IDrink drink, bool isDeluxe) : base(drink)
        {
            hotChocolate = new HotChocolate();

            if (isDeluxe)
            {
                hotChocolate.MakeDeluxe();
            }

            this.Name  = hotChocolate.GetNameOfDrink();
            this.Price = hotChocolate.Cost();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var espresso = new Espresso();

            Console.WriteLine(espresso.GetDescription());
            Console.WriteLine(espresso.Cost());
            var espressoWithChoc = new HotChocolate(espresso);

            Console.WriteLine(espressoWithChoc.GetDescription());
            Console.WriteLine(espressoWithChoc.Cost());
            var espressoWithChockAndDoubleSyrop =
                new MapleSyrup(new MapleSyrup(espressoWithChoc));

            Console.WriteLine(espressoWithChockAndDoubleSyrop.GetDescription());
            Console.WriteLine(espressoWithChockAndDoubleSyrop.Cost());
        }
Exemplo n.º 4
0
 public double GetPrice()
 {
     return(_adaptee.Cost());
 }
 public override double GetPrice()
 {
     return(_chocolate.Cost());
 }
Exemplo n.º 6
0
 public double GetPrice()
 {
     return(_hotChocolate.Cost());
 }
Exemplo n.º 7
0
 public override double GetPrice()
 {
     return(Drink.GetPrice() + chocolatedrink.Cost());
 }
Exemplo n.º 8
0
 protected double GetPrice()
 {
     return(chocolate.Cost());
 }