Jun 22, 2022
Good question! I assume you're talking about foo3 which isn't defined in Base1. The b1_ptr actually doesn't have access to foo3. Calling b1_ptr->foo3() indeed fails. The blue outline defines everything that the Base1 pointer can see, aka the Base1's view. However, foo3's function pointer is still right after foo1's in memory, but b1_ptr is unaware of it! If you do some crazy c++ trickery you might be able to extract foo3's function pointer and call it.