00001
00002
00003
00004
00005 #ifndef __ARRAY_FN3_CPP__
00006 #define __ARRAY_FN3_CPP__
00007
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 #include <iostream.h>
00011
00012
00013 class ArrayFn;
00014 typedef void ( ArrayFn::*JCALLBACK )( int );
00015
00016 class ArrayFn {
00017 public:
00018 void fn0(int a) { cout << "fn0-[" << a << "]"; }
00019 void fn1(int a) { cout << "fn1-[" << a << "]"; }
00020 void fn2(int a) { cout << "fn2-[" << a << "]"; }
00021
00022
00023
00024
00025 static JCALLBACK Table[];
00026
00027 void Disp( int a, int b )
00028 {
00029 ( this->*ArrayFn::Table[a] )(b);
00030 }
00031 };
00032
00033
00034 JCALLBACK ArrayFn::Table[] = {
00035 ArrayFn::fn0,
00036 ArrayFn::fn1,
00037 ArrayFn::fn2
00038 };
00039
00040 void main() {
00041 ArrayFn af;
00042 af.Disp( 0, 2 );
00043 }
00044
00045 #endif
00046