I'm working on simple framework written on C++. Now i have something like
app.cpp
#include "app.h"
namespace App
{
}
void App::init()
{
}
void App::timerEvent(int time)
{
}
But what if i don't want to listen to timerEvent in some cases? I still have to write empty method implementation.
My idea is to move from namespace to class App : public BaseApp with virtual void BaseApp::init() = 0 and virtual void BaseApp::timerEvent(int time) {} in BaseApp (similary to Qt QApplication). However App should be singleton then, but i don't see any way to specify it from BaseApp, so i have to write singleton code in App and all virtual idea makes no sense.
How should i design it?
P.S. I don't want to use listeners here. It seems like overkill for me.
Aucun commentaire:
Enregistrer un commentaire