Write a C++ program that uses 7 classes following a tree inheritance structure.
The base class must also have a virtual print() function that displays the class name.
Randomly assign print functions in three other classes that display the class name.
Create 7 pointers of the base class and have them point to all the classes.
Use the pointers to call print functions of all classes.© BrainMass Inc. brainmass.com March 21, 2019, 7:49 pm ad1c9bdddf
We will start by creating an inheritance structure where each class has two subclasses. The diagram looks like following:
D E F G
The virtual ...
This solution provides a simple example of class inheritance in C++. It also illustrates the difference between virtual and non-virtual overridden methods.