Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Test/ArrayFn3.cpp

Go to the documentation of this file.
00001 // Fred P. for J2K Library
00002 // LGPL Licensed.
00003 // http://j2k.sourceforge.net/
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 // The only way to make function pointers with Borland!
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 //  typedef void ( ArrayFn::*JCALLBACK )( int );
00023 
00024   //extern static void ( ArrayFn::*Table[] )( int );
00025   static JCALLBACK Table[];
00026 
00027   void Disp( int a, int b )
00028   {
00029     ( this->*ArrayFn::Table[a] )(b);
00030   }
00031 };
00032 
00033 // static
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 

Generated on Sun Oct 14 18:46:43 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001