This is one of things that I should've learned years ago and never really focused much on it. However, now it's causing a problem for me while trying to make an event class with separate events all derived from 'Event'.
Doing, this, ve still has the type (Event*), which means that the variables I'm trying to siphon from the Event (which is verified that it is of DerivedEvent* type), does not exist and therefore causes a segfault. How is this normally done to cast a base class down to it's derived class. m_EventHolder->Poll() returns type (Event*) even though the thrown event is of the derived type. Is that the way it should be, or not?Code:Event* newEv = new NewDerivedEvent; newEv = m_EventHolder->Poll(); NewDerivedEvent* ve; ve = static_cast<NewDerivedEvent*>(newEv);