patterns/decorator/coffee/soy.d

25 lines
436 B
D
Raw Normal View History

2022-12-05 07:38:19 +00:00
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();
}
}