vtable (how virtual works)
Në shqip: Tabela virtuale
ShpjegimiSQ
Si i di C++ cilin version të një metode virtuale të thërrasë? Çdo klasë me metoda virtuale ka një tabelë me adresat e tyre (vtable), dhe çdo objekt mban një pointer drejt saj. Kjo kushton pak shpejtësi.
EnglishEN
How does C++ know which version of a virtual method to call? Every class with virtual methods has a table of their addresses (the vtable), and every object holds a pointer to it. This costs a little speed.
Si ta mendosh
Si lista e numrave të telefonit për secilin departament: e shikon dhe e di kë të thërrasësh.
Lexoje në anglisht
Like a phone list for each department: look it up and you know whom to call.