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:
“Women are denied masturbation even more severely than men and thats another method of controltheyre not taught to please themselves.... Most womenit takes them a while to warm up to the situation but once they get into it, Im sure theyre going to get just as hooked aswell, everyone I know is!”
—Lydia Lunch (b. 1959)