I have been reading the 'inside the c++ object model' by Lippman and one of the sections has me a little confused. It is the section where the author explains how virtual tables are created and virtual pointers assigned, in the scenario of multilevel, single inheritance. If anyone here has the book i'm referring to the diagram on page 129, figure 4.1 (I think there's only 1 edition) and the statement mentioned on the next page that if a derived class adds a new virtual function, a slot is added to the end of virtual table which contains the address of the new virtual function. Now since there's only 1 vptr in the class, how does the compiler stop it from accessing the new virtual function even if I have a base pointer pointing to a child pointer. As the vptr, if i'm not wrong is the same?
If needed I can upload an example object model.