I recenty had a telephone interview in which I was asked about the internal implementation of the virtual mechanism.
I described roughly that a table is compiled with the class (at the top of the memory block?) which holds pointers to the addresses of the appropriate method implementation according to which derived class the object is, so when a base pointer is used to access a virtual method, I guess its compiled so that it infact references to an index in the vtable which for the given instance at run-time would be the address of the appropriate derived method.
However I could give precise details of the internal implementation of the table or say how to access it from client code, so I failed the question.
Is this part of the C++ standard or is it compiler specific, I'm having difficulty finding more detail on the internals of this in the Bjarne Stroustrup book, may be I'm looking in the wrong place.
Forum discussion on this is often varied and not always easy to follow, aso not official, is there an ansii doc. Do I need a C++ compiler text book, I looked on Amazon but there were very few books and no descriptions or reviews.
Even if I did know this in detail, isn't this the kind of thing one would restudy a reference for if one were going to implement something in relation to it. I think my agent now thinks I don't know C++ cos I flunked this one question. The vacancy wasn't for safety critical or driver implementation or anything like that!!
Any help or advice greatly appreciated.