//funcptr
//author_zhangsisi_04_19
class name;
typedef void ( name::*funcptr )( void );
#ifndef _A_DEMO_
#define _A_DEMO_
#include <iostream.h>
class name
{
public:
void func0() { cout << "the first demo ->func0!" << endl; }
void func1() { cout << "the second demo ->func1!" << endl; }
static funcptr func[ 2 ];
};
#endif
funcptr name::func[ 2 ] = { name::func0, name::func1 };
#include <iostream.h>
int main()
{
name na;
for ( int i = 0; i < 2; i++ )
(na.*name::func[ i ])();
return 0;
}