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