c++ - Virtual functions table offset -


I would like to ask you what does the table offset of virtual functions depend on the class? I mean, at least what I have read depends on the compiler, but does it change from orbit to class?

EDIT: By Offset I mean the position of the table relative to the owner's address.

Edit: Example code:

  void ** vtable = * ((null ***) (((four * object object + offset)); int * * Ivtable = (int **) vtable; zero * first function = (zero *) ivtable [0];  

Dependency on a certain class is definitely.

Remember that there is multiple inheritance (MI) in C ++ the result of Mi is that one object has several base subjects Those courses can not be at the same address. It also means that The base sub-objects do not actually start offset offset 0.

Now, this introduces a little bit of complexity with MI VTable: you exchange functions from multiple bases on different offsets. For this reason, MI classes are quite common to use different vtable layouts.

On the related note, MI also means that every point in the object is actually The beginning that obs It is quite likely that a secondary word * indicator derived object is offset from size (FirstBase) i.e. in the middle of that point Somewhere derived objects.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -