So i\'m working on a simple win32 wrapper for my own convenience, and i\'ve run into a slightly complicated problem.
this has alot of other members, but i\'m omittin
You should read up on the Curiously Recurring Template Pattern (http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern).
Basically, you turn your base class into a template with a template parameter that specifies the sub-class.
Perhaps it'll be easier to understand if you see it:
namespace Windows
{
template
class AbstractWindow
{
public:
void InstallHandler(UINT msgName, void (T::*)(HWND, UINT, WPARAM, LPARAM));
private:
std::map HandlerIndex;
};
}
class BasicWindow : public Windows::AbstractWindow< BasicWindow >
{
public:
BasicWindow()
{
InstallHandler(WM_CREATE, &BasicWindow::Create);
}
private:
void Create(HWND, UINT, WPARAM, LPARAM) {}
};