Can you override a C++ message callback
I have a Parent()
class that subscribes to a message /foo
with a method messageCallback
.
Can a derived class Child : public Parent
override the messageCallback
method to get notified each time a new /foo
message arrives?
The alternative I've come up with is to have both Parent
and Child
subscribe to the /foo
message and do separate things in their separate callbacks.
Asked by Felix Duvallet on 2016-04-13 03:35:44 UTC
Comments
I haven't verified this, but if you'd use
boost::bind(..)
, it should allow you to bind a virtual method (see here), which you could then override in your subclass.Asked by gvdhoorn on 2016-04-13 03:47:59 UTC