Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page
C++ - Reflect
► Problem Description: Write a c++ program that can call functions from within itself dynamically. Ensure the code works properly on both windows and unix.
► Example Usage:
int main() { ModuleHandle theHandle = doOpen(); if(theHandle == NULL) { std::cout << "Call to 'doOpen' failed\n"; return(1); } int i = 1; while(true) { std::ostringstream out; out << "f" << i++; FunctionPointer fp = (FunctionPointer)getFunction(theHandle, out.str()); if(!fp) break; fp(); } doClose(theHandle); }
► Example Output:
f1 f2 f3
► Source code