Re: [Dev-C++] typedef of pointers to functions compile error
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Stefan K. <ste...@ya...> - 2003-11-07 07:49:20
|
Hi Ben,
I got this piece of code to compile under Dev-Cpp. It illustrates how to
use member function pointers in C++. From what I know, it is ISO
compliant to do it this way, so it should work with all ISO compliant
compilers.
Best,
Stefan
class Data{
public:
typedef int (Data::*FUNC_GET)(void);
int GetData(FUNC_GET fn){ return (this->*fn)(); }
int Test1(void) { return 5; }
};
Data data;
int x = data.GetData( &Data::Test1 );
--
Stefan Kuhn
Software Development
ste...@ya...
|