Tim Van Wassenhove

Passionate geek, interested in Technology. Proud father of two

11 Feb 2006

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; 
	method mymethod = dosum(); 
	cout << mymethod(10, 4) << endl; 
	return 0;