main {
thingies = [ purpleThingy, littleThingy ]
interactions = [ commentOn, cherish ]
for (interaction in interactions)
for (thing in thingies)
interaction.interact(thing)
}
The author does mention things like "function pointers can be used in simple cases" and "std::variant would avoid the need to overload the method". But the main reason for having the C++ code the way it is is because "you can't dispatch to overloaded methods at runtime".
https://cppcrypt.tumblr.com/post/169439207562 ff.