2 ms·
> If there is some specific edge case around ctors then forgive me - this is C++ after all! Yes, the specific edge case is around ctors and dtors. During the c
by cesarb 5y ago
> If there is some specific edge case around ctors then forgive me - this is C++ after all!
Yes, the specific edge case is around ctors and dtors. During the ctor or the dtor, the vtable is the vtable of the base class, not the derived class, so if you call a virtual function within the ctor or dtor of the base class (don't do that), the function which will be called is the one from the (possibly abstract) base class. See for instance this FAQ entry: https://isocpp.org/wiki/faq/strange-inheritance#calling-virtuals-from-ctors https://isocpp.org/wiki/faq/strange-inheritance#calling-virt...