Does every object of virtual class have a pointer to vtable?
Or only the object of base class with virtual function has it?
Where did the vtable stored? code
Try this at home:
#include
struct non_virtual {};
struct has_virtual { virtual void nop() {} };
struct has_virtual_d : public has_virtual { virtual void nop() {} };
int main(int argc, char* argv[])
{
std::cout << sizeof non_virtual << "\n"
<< sizeof has_virtual << "\n"
<< sizeof has_virtual_d << "\n";
}