Every C++ object that has a virtual function has a vptr that points to a vtable. How can I see what this vptr is, and the contents it is point to? I understand this is compiler dependent and it could put vptr anywhere in the object memory space. But is there anyway I can find what it is?
Cheers.
In this specific case, C has one vtable and A and B have none. You can see this for yourself by out-of-lining C's member functions, so that the vtable will actually be emitted, and correcting the other compile errors: extern "C" int puts(const char *);
... compiling to an object file, and then looking at the symbols:
By above steps you can find the content it points to.