I have two classes in C++:
class Base
{
int baseField;
public:
Base();
~Base();
T BaseMethod();
virtual SomeMethod()=0;
};
class Derived : public Base
{
int derivedField;
public:
Derived()
~Derived();
T DerivedMethod();
virtual SomeMethod() {...}; // Some implementation
};
My question is how it's represented in memory, i.e. where is this pointer, vptr (vtable) fields and methods pointers of this class. Ok, it's compiler dependent, but there is some unwritten standards. I'm most interested in Visual Studio and gcc compilers.
[Edit: I put one virtual method to improve example, there weren't any virtuals before]
Is there some books writing on this theme in details