After wondering for an hour or so why my application does not receive any “scripted” commands, I found that invoke() is non-virtual. I had to type cast each message receiver to the most specific subclass to make it work. This was a bit tricky, because at the places where these commands are sent, the app class is not known.
It would make sense to make invoke() et al virtual, so we can write generic scripting for applications.
(off topic rant:)
On a side node, the more I get into complex development, the more I am having a hard time getting along with the limitations of C++. Man, is this frustrating and depressing. Isn’t there the slightest possibility to use a clean polymorphism? I can’t seem to get used to the absurd fact I have to type cast message receivers in order to ensure that the right code at the correct level in the class hierarchy is executed (shudder). How is a sender supposed to always know all subclasses in advance? In order to implement algorithms in a base class (“behavior”), I need to make sure they can be overridden or extended by derived classes as needed later on. This is what I learned is inheritance and polymorphism.
I am inclined to radically just making everything virtual.