let’s say I have a class ofxFlashEventArgs which extends ofEventArgs.
is there any way in which I can pass an ofxFlashEventArgs object as if it was an ofEventArgs object?
meaning, for example, returning this event
ofEvent<ofxFlashEventArgs> testEvent;
from this method
ofEvent <ofEventArgs> & getEvent(){
return testEvent;
}
another example would be to register a listener with a method that expects an ofEventArgs, but then notify with ofxFlashEventArgs.
class SomeClass {
ofEvent <ofxFlashEventArgs> flashEvent;
}
// ------------
void testapp::setup(){
ofAddListener(SomeClass->flashEvent, this, &testApp::onFlashEventOccured); // this works
ofAddListener(SomeClass->flashEvent, this, &testApp::onAnyEventOccured); // this doesn't
}
// this works
void testAppp::onFlashEventOccured(ofxFlashEventArgs & args){
cout << "flash event happened" << endl;
}
// this doesn't
void testAppp::onAnyEventOccured(ofEventArgs & args){
cout << "any event happened" << endl;
}
intuitively, it makes sense to me, but I suspect it’s not possible (and both examples throw an error)
am I overlooking something?
thanks,
j