The member functions of C ++ are essentially similar to those of C. I think their function addresses are fixed.
For example
Class
{
Public:
Void F1 (){}
Virtual F2 ();
Void F3 () {m_value = 0 ;}
PRIVATE:
Int m_value;
};
The address of F1, F2, and F3 is fixed. When each object calls a function, it only passes in the address pointer of the object itself, the function internally uses the this pointer to find information such as member variables and virtual function tables, because the member variables and virtual function tables are related to each object, and the function address is fixed,CodeSegment.
A * A = new ();
A * B = NULL;
A-> F1 (); // OK
A-> F2 (); // OK
A-> F3 (); // OK
B-> F1 (); // OK,
B-> F2 (); // error. This is null. An error occurred while searching the virtual function table.
B-> F3 (); // error. An error occurred while searching for the member variable m_value.