I'm new to function pointers and am getting hung up on syntax. What I'm trying to do is define, within a class, an array of functions to do string matching. The matching functions and their storing array will be static since they will be shared by all instances of the class. The functions are stored in an array so I can iterate through within match() and try different ones. Also, I'm trying to typedef the function pointer globally because similar matching functions will be used in many such classes. I've found some stuff suggesting that the signature should maybe be bool(Money::FP)(char str) but, if true, is there no way that I can define this globally (i.e. for classes other than "Money")?
The code below does not compile so please consider it as pseudocode for what I'm trying to accomplish.
Money.h:
typedef bool(*FP)(char* str);
class Money
{
private:
static FP matchers[3] = {
Money::m1,
Money::m2,
Money::m3
};
static bool m1(char* str);
static bool m2(char* str);
static bool m3(char* str);
public:
static void match(char* str);
};