C++ access to a class declared and defined inside cpp file
i'm working on a project with third party libraries that use some scripts
where classes are declared and defined inside .cpp files. They initialize
these classes using an external constructor function that registers the
instances inside an iterator to be executed on trigger events.
In this way these class seems to be not accessible from external files.
But i need to use them using a not invasive method, in some way that not
require to rewrite third-party code.
this is the pseudo scenario:
"script.cpp"
#include "scriptLoader.h"
class theirScript {
public:
theirScript() : RegisterScript("theirScript") {}
static void anUsefullStaticMethod() { ... }
}
void addTheirScript() {
new theirScript();
}
"scriptLoader.h"
void addTheirScript();
"scriptLoader.cpp"
#include "scriptLoader.h"
addTheirScript();
"myFile.cpp"
#include "scriptLoader.h"
theirScript::anUsefullStaticMethod(); // will never work
how can i access to "theirScript" class then? is there a way where i don't
have to rewrite their code?
No comments:
Post a Comment