Topic: Call member functions by address?


Author: eleea4e@menudo.uh.edu (Tim Arone)
Date: 10 Nov 1994 09:42:16 -0600
Raw View
 I have a piece of C++ code here,

 Header file:

 class CMyClass:
 {
 public:
  typedef BOOL (CMyClass:: * MYPROC)(void);
  MYPROC FunProc;

  BOOL Func1();
  BOOL Func2();

 }


 Implement file:

 CMyClass::CMyClass()
 {
  FunProc = Func1;
  FunProc(); // or (*FunProc)();
  ^^^^^^^^^
   // compiler won't allow it, I am using microsoft VC++.

 }


 BOOL CMyClass::Func1()
 {
 ...
 }


 I was trying to call a member function through its procdure address.
 Just could not get it  work. Could Anyone help me out here?


 Ken Ting
 via
 eleea4e@menudo.uh.edu