C++: is a class with virtual base but without virtual functions polymorphic and has VTable?
问题 Consider the following code: #include <iostream> #include <typeinfo> #include <type_traits> using namespace std; struct A { int data; }; struct B1 : A {}; struct B2 : virtual A {}; struct Base1 : virtual A {}; struct Base2 : virtual A {}; struct Derived : Base1, Base2 {}; int main() { cout << sizeof(B1) << endl; cout << sizeof(B2) << endl; cout << sizeof(Derived) << endl; cout << std::is_polymorphic<B1>::value << endl; cout << std::is_polymorphic<B2>::value << endl; cout << std::is