This is not about “When VTABLE is created?”. Rather, when the VPTR should be initialized? Is it at the beginning/end of the constructor or before/after the constructor?
A::A () : i(0), j(0) -->> here ?
{
-->> here ?
//...
-->> here ?
}
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.
The machinery for virtual calls (usually a v-table, but doesn’t need to be) is set up during the ctor-initializer, after construction of base subobjects and before construction of members. Section
[class.base.init]decrees:Actually, during construction of the base subobjects, the virtual function machinery exists, but it is set up for the base class. Section [
class.cdtor] says: