Function Pointer - Method Pointers

Method Pointers

C++ is object-oriented, so classes can have methods. Non-static member functions (instance methods) have an implicit parameter (the this pointer) which is the pointer to the object it is operating on, so the type of the object must be included as part of the type of the function pointer. The method is then used on an object of that class by using one of the "pointer-to-member" operators: .* or ->* (for an object or a pointer to object, respectively).

Although function pointers in C and C++ can be implemented as simple addresses, so that typically sizeof(Fx)==sizeof(void *), member pointers in C++ are often implemented as "fat pointers", typically two or three times the size of a simple function pointer, in order to deal with virtual inheritance.

Read more about this topic:  Function Pointer

Famous quotes containing the word method:

    I know no method to secure the repeal of bad or obnoxious laws so effective as their stringent execution.
    Ulysses S. Grant (1822–1885)