patterns/decorator/coffeewithsize/milk.d

26 lines
464 B
D

module decorator.coffeewithsize.milk;
import decorator.coffeewithsize.beverage;
import decorator.coffeewithsize.condimentdecorator;
class Milk : CondimerDecorator
{
private:
Beverage beverage;
public:
this(Beverage beverage)
{
this.beverage = beverage;
}
override string getDescription()
{
return beverage.getDescription() ~ ", Milk";
}
override double cost()
{
return .10 + beverage.cost();
}
}