Message Sub-classes and const

Is there a better way to do this? The Message docs say ‘just make a subclass’ which sort of implies more ease?

Message* inMsg = const_cast<Message*>(&message); XMLCommandINMessage* inCommand = dynamic_cast<XMLCommandINMessage*>(inMsg);

Any other combo won’t compile.


Why not just:


ah, the other way around. I was focussed on co-ercing the message to my will, not bending like a reed etc. etc.


Sorry, just as a follow-up, I was getting odd messages and couldn’t tell because of the d_cast reference. Using pointers lets me test for null, so that’s working out better.

Do I need to do anything to tell the system I’m done with a message? And they do just come to the item they were posted to, right?


Yes, they just go where they’re sent, and will get automatically deleted after your handler method returns.