Best way to organize singleton with virtual methods
<p>I'm working on simple framework written on C++. Now i have something like</p>

<p><strong>app.cpp</strong></p>

<pre><code>#include "app.h"

namespace App
{

}

void App::init()
{

}

void App::timerEvent(int time)
{

}
</code></pre>

<p>But what if i don't want to listen to timerEvent in some cases? I still have to write empty method implementation.</p>

<p>My idea is to move from namespace to <code>class App : public BaseApp</code> with <code>virtual void BaseApp::init() = 0</code> and <code>virtual void BaseApp::timerEvent(int time) {}</code> in <code>BaseApp</code> (similary to Qt <code>QApplication</code>). However App should be singleton then, but i don't see any way to specify it from <code>BaseApp</code>, so i have to write singleton code in <code>App</code> and all virtual idea makes no sense.</p>

<p>How should i design it?</p>

<p>P.S. I don't want to use listeners here. It seems like overkill for me.</p>

<p>P.P.S. I need singleton because i initialize app instance from <code>main</code>, but still want to access its methods from another classes.</p>