Write a C++ program to use pointer for both base and derived classes and call the member function.