Semua buku

Profesional

Aplikasi Tentang Pelatih Masuk Mulai membaca

Computer Science · Glosarium

Apa itu Dispatch table, table pointer?

Dikenal juga sebagai: dispatch table · vtable · table pointer

Definition 3.5 University Computer Science — Year 2 · Bab 3 — Inheritance and Polymorphism

The dispatch table (or vtable) of a class with virtual functions is an array, one per class and built by the compiler, of the addresses of the versions of its virtual functions that apply to that class. Each object of the class holds a table pointer to its class’s table. A virtual call loads the table pointer from the object, loads the address from a fixed position in the table, and calls it.

The two objects of , of two classes. A call s->table->area(s), or its C++ form s->area(), follows the object’s table pointer to its class’s table, takes the address at the position reserved for area, and calls that function with the object.
The two objects of Listing 3.7, of two classes. A call s->table->area(s), or its C++ form s->area(), follows the object’s table pointer to its class’s table, takes the address at the position reserved for area, and calls that function with the object.
Baca dalam konteks →