Preparing for my internship

Only two more days before my internship starts. I’m a bit nervous and excited to dive into this adventure. Today i decided to fresh my knowledge of (MS)-C++ a bit up. I’ve read a tutorial on function pointers and naming conventions. A couple of weeks ago i already had a look at pointers to member functions.

#include <iostream>
using namespace std;

void customcallback() {
        cout << "running custom callback" << endl;
}

typedef int (*method)(int, int);

int sum(int a, int b) {
        return a + b;
}

method dosum() {
        return &sum;
}

int main() {
        void (*plugin)() = NULL;
        plugin = &customcallback;
        plugin();

        method mymethod = dosum();
        cout << mymethod(10, 4) << endl;

        return 0;
}

This entry was posted on Saturday, February 11th, 2006 at 21:26 and is filed under C++. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.