1. InheritanceUsing the Tree Class
Begin by creating a new Tree classmember function named showSymbol() that displays a single characterrepresenting a Tree object. For example, use '!' as the symbolfor aTree object. The function should have a reference to an ostreamobject as its parameter. Next, using the Tree class as the baseclass, create derived class Oak. Class Oak will not have any newdata members. It will have as public member functions a defaultconstructor, a constructor with parameters, and showSymbol() whichdisplays the character '@' to represent an oak tree. After testingthe Oak class, derive a similar Pine class. The Pine classshowSymbol()member function should display the character '^' torepresent a pine tree.
With the Tree base class and derivedclasses Oak and Pine, you can explore the concept ofpolymorphism. Write a main() driver function that createsa Tree object, an Oak object, and a Pine object. Then create abase class pointer named treePtr, i.e., one that points toa Tree object. Then, in turn, assign the address of each object totreePtr and call showSymbol() using either of the followingmethods:
Did you get the correct symbol foreach tree? If not, modify the declaration part of theTree class sothat showSymbol() gives the correct symbol for each object,illustratingpolymorphism.