Article View: borland.public.cppbuilder.nativeapi
Article #16510Class Function Pointer Problems!!!!
From: 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
Technical Details
Message-ID:
<3ebf6d67$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!216.166.71.118.MISMATCH!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,dae92cae35c66cbe,start X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-05-12 02:51:36 PST From: "Al" <Damnit@HEll.Pfft> Sender: "Al" <Damnit@HEll.Pfft> Reply-To: "Al" <Damnit@HEll.Pfft> Subject: Class Function Pointer Problems!!!! Newsgroups: borland.public.cppbuilder.nativeapi X-User-Info: 194.205.73.2 194.205.73.2 NNTP-Posting-Host: 207.105.83.65 Message-ID: <3ebf6d67$1@newsgroups.borland.com> Date: 12 May 2003 02:46:15 -0700 X-Trace: newsgroups.borland.com 1052732775 207.105.83.65 (12 May 2003 02:46:15 -0700) Lines: 42 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!216.166.71.118.MISMATCH!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail