C function needs to call a member function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • manu1001
    New Member
    • Jul 2007
    • 14

    C function needs to call a member function

    I've an old C function that calls a function pointed by a global function pointer. How do I get it to call a member function of a class object determined at run-time. It'll be complied in a C++ project of course.
    My main motive is reusability here. So I don't want to change the C function.

    Its something like this:
    Code:
    void (*foo)(int);
    
    class coo
    {
      public:
            void func(int x){ ; }
    };
    
    void cfunc()
    {
      foo(10);  
    }
  • DaemonCoder
    New Member
    • Mar 2008
    • 43

    #2
    Creating a Function Pointer to a C++ Member Function

    Creating a Function Pointer to a C++ Member Function - I think this is what you are trying to do....
    http://support.microsoft.com/kb/94579 - Depending on your compiler I believe this article will help...
    Last edited by DaemonCoder; Mar 9 '08, 04:57 PM. Reason: Typo's

    Comment

    Working...