Skip to content

static_cast on EventListener is not working #4

@sinadogru

Description

@sinadogru

How can you down cast on compile-time when the base is virtual?

https://github.com/MCGallaspy/events/blob/master/events.h#L73

this line gives me an error, here is the compiler (g++ 5.4) error:

events.h:73: error: cannot convert from pointer to base class ‘EventListener<>’ to pointer to derived class ‘EventListener’ because the base is virtual
static_cast<EventListener*>(listener)->onEvent(evt);
^

Also tried with g++ 5.2 and it also gave the same error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions