module caffeinebeveragewithhook;

import std.stdio : writeln;

abstract class CaffeineBeverageWithHook
{
    final void prepareRecipe()
    {
        boilWater();
        brew();
        pourInCup();
        if (customerWantsCondiments())
        {
            addCondiments();
        }
    }

    void brew();

    void addCondiments();

    void boilWater()
    {
        writeln("Boiling water");
    }

    void pourInCup()
    {
        writeln("Pouring into cup");
    }

    bool customerWantsCondiments()
    {
        return true;
    }
}
