module factorymethod.pizzasimple.pizza; import std.stdio : writeln; abstract class Pizza { protected: string name; string dough; string sauce; string[] toppings; public: string getName() { return name; } void prepare() { writeln("Подготовка " ~ name); } void bake() { writeln("Выпечка " ~ name); } void cut() { writeln("Резка " ~ name); } void box() { writeln("Упаковка " ~ name); } override string toString() const @safe pure nothrow { string s; s ~= "---- " ~ name ~ " ----\n"; s ~= dough ~ "\n"; s ~= sauce ~ "\n"; foreach (val; toppings) { s ~= val ~ '\n'; } return s; } }