#include #include #include "derived.h" using namespace std; int main() { derived d {10, 20}; d.print(); //calls the derived::print cout << "\n"; //Late binding, a.k.a. dynamic binding: //calls derived::print, the print member function of class derived, //thanks to the keyword virtual in base.h. base *p {&d}; p->print(); cout << "\n"; //Late binding, a.k.a. dynamic binding: //calls derived::print, the print member function of class derived. //thanks to the keyword virtual in base.h. base& r {d}; r.print(); cout << "\n"; }