I'm trying call a method initialised by pointer to a method of other class, i've followed this: but it has not worked for me.
consider this:
class y
{
public:
int GetValue(int z)
{
return 4 * z;
}
};
class hooky
{
public:
int(hooky::*HookGetValue)(int);
};
int(hooky::*HookGetValue)(int) = (int(hooky::*)(int))0x0; // memory address or &y::GetValue;
int main()
{
hooky h; // instance
cout << h.*HookGetValue(4) << endl; // error
return 0;
}
the error that produces is:
[Error] must use '.' or '->' to call pointer-to-member function in 'HookGetValue (...)', e.g. '(... ->* HookGetValue) (...)'