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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.