|
-
April 14th, 2005, 04:44 PM
#1
pure virtual functions in a DLL
ok... first, let me say that I was playing with pure virtual functions, and got it to work all in one app. This is how I did, it really:
in TheClass.h (example):
Code:
class CMyClass
{
public:
CMyClass();
virtual void Initialize() = 0;
};
in TheClass.cpp:
Code:
#include "TheClass.h"
CMyClass::CMyClass()
{
Initialize();
}
in Main.cpp:
Code:
#include "TheClass.h"
class MyClass2 : public CMyClass
{
public:
void Initialize()
{
cout << "YAY!" << endl;
}
}
int main()
{
MyClass2 Blah;
//some random code
return 0;
}
That worked all in one app, just fine. So, while expirementing with it, I figured it'd be useful if I could put TheClass.h and TheClass.cpp into a DLL. The compiling worked great, but then linking came, and it said along the lines of:
error LNK2019: unresolved external symbol "public: virtual void __thiscall CMyClass::Initialize(void)"referenced in function "public: __thiscall CMyClass::CMyClass(void)"
So, my question is, is there any way that I can seperate it into a DLL like that? I tried taking off the "= 0" and doing just a "{ cout << "ok" << endl; }" thing, and that worked great, but then the new function created in the app was never called.
I guess it's fine if it can't be done, but I figured I'd see if someone knows a way anyway... I guess I'm just figuring mabye it's possible, and then I can make use of it. 
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|