#include #include #include "base.h" //not necessary, since base.h already included in derived.h #include "derived.h" using namespace std; void construct_and_destruct_a_base(); void construct_and_destruct_a_derived(); //Construct and destruct a base object and a derived object. //For clarity, their lifetimes do not overlap. int main() { construct_and_destruct_a_base(); cout << "------------------------\n"; construct_and_destruct_a_derived(); return EXIT_SUCCESS; } void construct_and_destruct_a_base() { base b {10, 20}; cout << "The base object contains "; b.print(); cout << "\n"; b.f(); } void construct_and_destruct_a_derived() { derived d {10, 20, 30, 40}; cout << "The derived object contains "; d.print(); cout << "\n"; d.f(); //Demonstrate that class derived has inherited f. d.g(); //Demonstrate that class derived also has additional members. }