Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages
Started by Al
Mon, 12 May 2003 09:46
Class Function Pointer Problems!!!!
Author: Al
Date: Mon, 12 May 2003 09:46
Date: Mon, 12 May 2003 09:46
42 lines
1676 bytes
1676 bytes
Right, New class defined in the same old usual way. The problem is, as soon as I call the so called correct method, I can no longer access a variable, structure correctly.
class Tblah {
private:
typedef void (Tblah::*aFunction)(void);
public:
void Main();
void DoThis(void);
TStringList *strList;
} blah;
/*.. cpp file now ..*/
void Tblah::Main()
{
strList = new TStringList();
strList->Add("TEST");
/* THIS IS INCORRECT RIGHT...WONT COMPILE */
aFunction myFunc = DoThis;
myFunc();
/* APPARENTLY CORRECT */
aFunction myFunc2 = DoThis;
(blah.*myFunc2)();
delete strList;
}
void Tblah::DoThis(void)
{
//ERROR !!!
ShowMessage(strList->Strings[0]);
}
WHY CAN'T I ACCESS IT CORRECTLY?!
Cheers
Al
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads