[an error occurred while processing this directive]
|
Например,
class A
{
public:
void callme(const char *msg);
};
int main()
{
callme obj; // instantiate object
typedef void (A::*MFN)(const char *); // type of member-pointer
MFN mfn; // instantiate pointer
callme* ptr = &obj; // pointer to an object
// call member
(ptr->*mfn)("Hello, world");
}
Совершенно очевидно, что для вызова члена класса необходимо иметь
указатель на сам обьект класса.