35 lines
878 B
D
35 lines
878 B
D
module decorator.coffee.app;
|
|
|
|
import decorator.coffee.beverage;
|
|
import decorator.coffee.espresso;
|
|
import decorator.coffee.darkroast;
|
|
import decorator.coffee.houseblend;
|
|
import decorator.coffee.decaf;
|
|
import decorator.coffee.mocha;
|
|
import decorator.coffee.milk;
|
|
import decorator.coffee.soy;
|
|
import decorator.coffee.whip;
|
|
import std.stdio : writeln;
|
|
|
|
void print(Beverage beverage)
|
|
{
|
|
writeln(beverage.getDescription(), " $", beverage.cost());
|
|
}
|
|
|
|
void main()
|
|
{
|
|
Beverage beverage = new Espresso();
|
|
print(beverage);
|
|
|
|
Beverage beverage2 = new DarkRoast();
|
|
beverage2 = new Mocha(beverage2);
|
|
beverage2 = new Mocha(beverage2);
|
|
beverage2 = new Whip(beverage2);
|
|
print(beverage2);
|
|
|
|
Beverage beverage3 = new HouseBlend();
|
|
beverage3 = new Soy(beverage3);
|
|
beverage3 = new Mocha(beverage3);
|
|
beverage3 = new Whip(beverage3);
|
|
print(beverage3);
|
|
} |