Hi there,
I have a fairly straightforward question. Check out the class below:
Code:
class winInterface
{
public:
virtual ~winInterface();
virtual HWND createWindow(HINSTANCE hInstance, WINPROC _winproc,
WCHAR* szTitle, WCHAR* szWindowClass, int nCmdShow) = 0;
HINSTANCE hInstance;
HWND hwnd;
WINPROC _winProc;
WCHAR szTitle[MAX_LOADSTRING];
WCHAR szWindowClass[MAX_LOADSTRING];
};
All this works fine. Provides a little interface to a derived class in a DLL which sets up a window (hence the pure virtual function). I noticed though I had terrible trouble yesterday with a linker error when I did not use the virtual keyword.
One way I got around this was to put a small definition of the function in the shared interface header file, which was to be over-rided later. Now I find since I've upped my game a bit and included the virtual keyword (like I was supposed to) it's no longer an issue.
None of this is a problem but... does that mean that provided you use the virtual keyword the compiler wont even ask for a function definition anywhere and will just tolerate that? Even though it has no access to the header file specific to the DLL where the function is actually defined? (I've checked that it doesn't).
I just sorta need to know...for some reason
Thanks