let me describe my thoughts in other words:
If you create a class in C++ which does not contain virtual functions, everything the compiler needs to known (for all modules) is the structure/class definition. The methods then are simply called by their name (e.g. Class::methode@Signature) and the linker does the fix up.
Not exactly. If it were done that way you could not replace a method in a derived class and you'd end up with multiple copies of the method code, one in each instance of the class.
In C and C++ a function's name is a pointer to the function's entry point... a variable like any other.
When a class or object is created, these pointers are concentrated in the class's vtable. The only place the method is called by name is in source code.
The other members are referenced by the corresponding structure pointer (this-pointer). Because no function pointers are used in the structure definition, derived classes must overwrite/hide the methods by redeclaring the same function (this must be supported by the language and is thus not possible with C in that way).
Function pointers are *hidden*... in C++ the vtable is hidden from the programmer... but a pointer to a vtable is always there.
This has nothing to do with virtual methods.
For classes with virtual methods, the class template get be copied and the constructor* then fix up the virtual method pointers of the base class (in the vtable). The virtual methods then can be called either by the base class or by the derived classes. The overwritten virtual methods of the base class can still be called through the template of the base class (unless the class is not abstract).
I'm right here?
Yes and no... You have the concept, but not the mechanics of it...
The root or base class has a pointer to a vtable (similar to an ASM jump list) that points to it's methods, including the constructor and destructor. When an inherited (or derived) class is instantiated, it's vtable pointer simply points to it's parent's vtable... No matter how many derived classes you make, there is only one copy of the vtable and one copy of each method in memory, unless you are replacing methods. If you overlay (replace) one or more methods in a derived class, then the derived class gets it's own copy of the vtable, with the new pointer(s) in it.
Here's what a C++ class (IExample) looks like in C...
typedef struct {
IExampleVtbl * lpVtbl;
DWORD count;
char buffer[80];
} IExample;
C++ hides the IExamplevtbl entry from the programmer and does tricks to make it look like it has it's own copy of the parent's methods ... but the vtable is there.
The vtable pointer is always the first entry in the struct (and thus at the same address as the struct itself). It points to a list of the addresses of the methods used in the class. If we make a second copy we can simply copy the first under a new name, call the constructor (always the first item in the Vtable) and use it with different data.
In C...
IExample test; // declaration of an instance
test->IExampleVtbl->IExample; // run the constructor
test->IExampleVtbl->copy(string); // run a method
In C++...
IExample test; // instance, constructor is run automatically
test::copy(string);
Both of the above do the same thing... it's just that in C++ it's hidden from you.