Any class having a virtual function would get an extra hidden pointer which would point to the most derived class.
What is the type of this vptr?
It has no type. It's an implementation detail unspecified by the standard; it is not part of the language.
Note that C++ doesn't say that there has to be a virtual table or a virtual "pointer" at all (though this is the most common implementation of RTTI in C++ toolchains).
Also, your analysis is wrong. In, say, GCC, usually each object gets a vptr that points to the relevant virtual table for that object's type: object has pointer, type has table.
The standard does not guarantee the presence of the virtual table pointer, even though most implementations use it.
As a result, it has no type. It is simply an array of pointers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With