On Thu, 2011-09-01 at 18:37 +0000, Fons Adriaensen wrote:
On Thu, Sep 01, 2011 at 02:18:25PM -0400, David
Robillard wrote:
If you're going to go with the inheritance
route anyway, just use a
virtual ev->execute() method so the code for all events doesn't have to
be in the same place. Assuming you'll have enough that this is actually
a benefit anyway...
That's assuming that the event's virtual execute() has access to
all it needs. In all cases I've encountered that is not the case:
the event triggers something in the context where it is received
and processing it requires access to that context's data.
It's a problem for which I don't know a clean C++ solution.
Sure, it would almost certainly not be a method with no parameters, most
likely you would pass some context object as a parameter which contains
all the necessary things.
-dr