patterns/decorator/coffee/soy.d

25 lines
436 B
D

module decorator.coffee.soy;
import decorator.coffee.beverage;
import decorator.coffee.condimentdecorator;
class Soy : CondimerDecorator
{
private:
Beverage beverage;
public:
this(Beverage beverage)
{
this.beverage = beverage;
}
override string getDescription()
{
return beverage.getDescription() ~ ", Soy";
}
override double cost()
{
return .15 + beverage.cost();
}
}