Hi All,
Except function pointer to a static member funciton of a class (or a
function).
As the following code, I could pointer a non-static member function of
a class.
And "Equal" was printed, the pointer has meaning.
But how can I use it??
I.e., I'd like to call the member method by using the function pointer
(like using c function pointer).
class TMyClass
{
public:
int DoIt(float a, char b, char c){ ... };
}
int (TMyClass::*pt2Member)(float, char, char) = NULL;
pt2Member = &TMyClass::DoIt;
// C++
if(pt2Member== &TMyClass::DoIt)
cout << "Equal" << endl;
pt2Member(1.2f, 'a', 'b'); //<------ error.
As u know, in case that the function pointer piont a non-static member
function, the pointer can invoke the member function.