SLAU132V October 2004 – February 2020
Pointer to member function objects are stored as a structure with three members, and the layout is equivalent to:
struct {
short int d;
short int i;
union {
void (f) ();
long 0;
}
};
The parameter d is the offset added to the beginning of the class object for this pointer. The parameter I is the index into the virtual function table, offset by 1. The index enables the NULL pointer to be represented. Its value is -1 if the function is nonvirtual. The parameter f is the pointer to the member function if it is nonvirtual, when I is 0. The 0 is the offset to the virtual function pointer within the class object.