Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Well, then everything is very simple, there is a lot of material https://www.google.ru/search?q=cpp+vtable
In short, each object has a pointer to a table with the addresses of its virtual functions. Different classes - different contents of the plates. Due to this, the method of the desired class for the object is called by its table, and not by the type of the pointer.
If you know assembler, it will be very instructive to write a simple example with a virtual function and see how it works in native code. There's quite a bit.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question