Function pointer / function member 
Author Message
 Function pointer / function member

Hi,

I am getting some trouble with the following code under VC++ 6.0,
it seem to work using g++. Any idea anyone ?

Vincent

--------------------------

#include <stdlib.h>
#include <stdio.h>

class MyClass;

typedef void (*function_ptr)(void);

class MyClass {
private:
    int value;

public:
    MyClass() { value = 0; }

    void echo() { printf("SUCCESS\n"); }

Quote:
};

int main()
{
    MyClass MyClassObject;
    void * Void_pointer;
    function_ptr Function_pointer;

    Void_pointer = (void *)(MyClassObject.echo);
    Function_pointer = (function_ptr)ptr;
    (*Function_pointer)();

    return EXIT_SUCCESS;

Quote:
}



Mon, 01 Oct 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How to use (pointer to function), and function and pointer to (pointer to function)

2. Pointers to member functions as function arguments

3. (member) function returning pointer to functions like itself?

4. Getting pointer to non-static member function from C callback function

5. Function Pointer for Member Function

6. Function pointer for Member Function

7. function pointer to a member function

8. Function Pointers to Member Functions

9. How to pass a member function as inetrnal function pointer argument

10. member functions as function pointers!

11. function pointer to a member function

12. member function as function pointer

 

 
Powered by phpBB® Forum Software