AM> exist more than once in memory. For example, how can I take a pointe
AM> to the following function and call it from that pointer? Thanx.
AM> class Boo : public TWindow
AM> {
AM> *
AM> *
AM> *
AM> void TempFunction(); <- non static
AM> };
void (Boo::*ptrToBooMemberFct)();
ptrToBooMemberFct = Boo::TempFunction;
To invoke it, you can use the following syntax:
Boo a;
(a.*ptrToBooMemberFct)(); // dereferenciation via variable
Boo *b = &a;
(b->*ptrToBooMemberFct)(); // dereferenciation via pointer
The following
void (*ptrToBooMemberFct)();
doesn't work because every non-static member function is passed an
implicit pointer (this) to the instance the method is applied on.
Thomas
---
þ MM 1.0 #0113 þ Drop your carrier...we have you surrounded!
---------------
* Origin: McMeier & Son BBS (2:301/138)
|