Technicality: Overriding To invoke a virtual function, you need – A reference, or – A pointer D d1; B& bref = d1; // d1 is a D, and a D is a B, so d1 is a B bref.f4(2); // calls D::f4(2) on d1 since bref names a D // pointers are in chapter 17 B *bptr = &d1; // d1 is a D, and a D is a B, so d1 is a B bptr->f4(2); // calls D::f4(2) on d1 since bptr points to a D Stroustrup/Programming33
{}