C++: How to use function pointers

I know how to use function pointers in C. But I'm writing a library in C++ and I'd like to use the C++ mechanism to pass a function pointer as parameter.

I want to add to my class a "setListener" method and pass the function pointer as parameter. This class will store the pointer, set up an interruption and call the listener function inside the ISR. The callback will be an static method defined in the main sketch file and having no arguments.

NOTE: I'm not using C++ 11, so please only traditional C++ answers.

Alexander Brevig added an event listener to the Keypad library
You could take a look there to see how he did it.

mstanley:
Alexander Brevig added an event listener to the Keypad library
You could take a look there to see how he did it.

Thanks. I've extracted the relevant code from Brevig's library:

//Variable declaration
void (*keypadEventListener)(char);

//Variable initialization
keypadEventListener = 0; //Better NULL instead of 0

//setListener implementation
void Keypad::addEventListener(void (*listener)(char)){
	keypadEventListener = listener; //Better &listener although is the same
}

//Use
if ( (keypadEventListener!=NULL))  {
	keypadEventListener(key[0].kchar);
}

Looks a lot like the C way.

Looks a lot like the C way.

It is. C++ is a superset of C.