This code gives error C2504: 'IKeyEvent': base class undefined
on line 3.
class IKeyEvent;
class EventDispatcher : private IKeyEvent {
public:
enum EEActions {
A_FEW_ACTIONS
};
private:
void OnKey(EventDispatcher::EEActions action, char multiplier);
}
class IKeyEvent {
public:
virtual void OnKey(EventDispatcher::EEActions action, char multiplier) = 0;
};
You cannot inherit from a class until it is defined, understandably. But I cannot define IKeyEvent
until after EventDispatcher
is defined.
I know I can move that enum
out of the Event Dispatcher
definition to make it global but this would require refactoring a large portion of the program. Is there any way to have EventDispatcher
inherit from a class dependent on EventDispatcher
?