Hello all!
I've come to a point where I want to have code that can be easily patched and replaced. (the program should load the file in the same directory as it, then use the code inside the file! Which is what modulization means to me, sorry if I used the wrong word).
Now I've been searching for a way to do this for a while now...
An example would be a Dynamic Link Library (.dll). But it doesn't entirely suit me - it requires a complete declaration of the class I want to use ahead. Including attributes and methods.
So here I am wondering if this is even possible, and if so how.
Here is an example of what I would like to do:
Code:
//inside linked file - header
class testClass
{
int i;
public:
testClass(int newI); //set i
int getInt(); //gets current value of I
}; //testClass
Code:
//inside linked file - source
testClass::testClass(int newI)
{
i = newI;
}//testClass(int)
int testClass::getInt()
{
return i;
}//getInt()
Code:
//inside application - header
//Code to load code from linked file
load class testClass;
Code:
//inside application - source
#include "header.h"
int main()
{
testClass me(2)
cout << me.getInt() << endl;
return 0;
}//main()