This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/factorymethod/pizzafactorymethod/app.d

38 lines
1.1 KiB
D

module factorymethod.pizzafactorymethod.app;
import factorymethod.pizzafactorymethod.pizza;
import factorymethod.pizzafactorymethod.pizzastore;
import factorymethod.pizzafactorymethod.nypizzastore;
import factorymethod.pizzafactorymethod.chicagopizzastore;
import std.stdio : writeln;
void main()
{
PizzaStore nyStore = new NYPizzaStore();
PizzaStore chicagoStore = new ChicagoPizzaStore();
Pizza pizza = nyStore.orderPizza("cheese");
writeln("Ethan ordered a ", pizza.getName());
pizza = chicagoStore.orderPizza("cheese");
writeln("Joel ordered a ", pizza.getName());
pizza = nyStore.orderPizza("clam");
writeln("Ethan ordered a ", pizza.getName());
pizza = chicagoStore.orderPizza("clam");
writeln("Joel ordered a ", pizza.getName());
pizza = nyStore.orderPizza("pepperoni");
writeln("Ethan ordered a ", pizza.getName());
pizza = chicagoStore.orderPizza("pepperoni");
writeln("Joel ordered a ", pizza.getName());
pizza = nyStore.orderPizza("veggie");
writeln("Ethan ordered a ", pizza.getName());
pizza = chicagoStore.orderPizza("veggie");
writeln("Joel ordered a ", pizza.getName());
}