When does the vptr (pointing to vtable) get initialized for a polymorphic class?
问题 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 ? } 回答1: 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: Member functions (including