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