Message Sub-classes and const


#1

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.

Bruce


#2

Why not just:

?


#3

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

Thanks.


#4

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?

Bruce


#5

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


#6