1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
class Base { public: virtual ~Base() {} virtual int foo() { return 1; } }; class Derived : public Base { public: virtual int foo() { return 2; } }; int main() { Base realbase; realbase.foo(); Derived d; Base *b = &d; return 0; // Set breakpoint here }