Dragonfly Q&A

Polymorphism error in onEvent()

0 like 0 dislike

So I appear to be getting a weird bug with regards to my onEvent function.

for (li.first(); !li.isDone(); li.next()) {
everything works fine up until my loop. I checked count, and it's correct, so it's recognizing that there is an element in my array, but when I call eventHandler, it doesn't know what to do. My ObjectList seems to like, not be remembering the class of the object. It's not calling eventHandler on my object, which is making it so that the event is never registered by the object.
Dragonfly version Personal
asked Sep 19, 2016 by ErikCerini

1 Answer

0 like 0 dislike
Does the parent (Object) eventHandler() get called instead?  Put a log message in Object::eventHandler() and check.  I suspect it is.  If so, check that the derived class signature is exactly the same and that the parent eventHandler() is declared virtual.
answered Sep 19, 2016 by claypool
Yeah. I just figured it out before I got the e-mail about your answer xD

I had forgotten the const in the signature of the child function.
More information about Dragonfly can be found on the Dragonfly Home Page.