If you want to have function pointers, I believe that the functions must be static, then you can't see the member variables from the static function. You may need to use a different approach like calling a CDialog member function that uses a switch statement to call the member functions. A little bit more messy, but you will have better encapsulation than writing a series of static functions. Coadtoad
C
coadtoad
@coadtoad
Posts
-
C++ Array Of Function Pointers problem -
C++ Array Of Function Pointers problemYour functions are public members. Are you initializing them in the .cpp file at the global scope or in a member function? If global, then I think that you are defining a new array that happens to have the same name as your member variable. You are not assigning values to your member array. Then when you call the function, the array is not initialized. Try this: In your OnInitDialog(): // Init the functions pointers here functionarray1[0] = CDialog::Func1 ; functionarray1[1] = CDialog::Func2 ; Later: // call the functions functionarray1[0]() ; functionarray1[1]() ; Make sure you declare Func1 and Func2 as static in CDialog.h void (*functionarray1[48])(); void static Func1() ; void static Func2() ; Coadtoad