#include #include #include "derived.h" using namespace std; int main() { base b0 {10}; base b1 {11}; derived d0 {20, 30}; derived d1 {21, 31}; base *a[] { //an array of pointers, can point to either base or derived &b0, &d0, &d1, &b1 }; for (auto p: a) { p->print(); //p is each pointer in the array of pointers cout << "\n"; } return EXIT_SUCCESS; }