5/5 – (2 votes)
● Define a class hierarchy with the following structure. You get to pick the problem domain, and I suggest you try to pick something you might have found useful in a project you may have worked on or would like to work on in the future. Here are the details:○ (20 points) Define an abstract base class (e.g., Shape) with one pure virtualfunction (e.g., area). This class should describe an abstract category (examplea Shape). Be sure this class has a constructor and at least one data member.○ (40 points) Derive three classes directly from your abstract base class andmake them concrete by providing implementations for the virtual function youintroduced in your abstract base class. The methods for each of these threeclasses must actually behave differently from one another (example: Circle areavs. Square area vs. Triangle area).○ (20 points) Write one interesting polymorphic function that operates on any typederived from your abstract base class. It should take a list (or array) ofinstances of your abstract base class (e.g., Shape *) and call the virtual functionon each to do something interesting. Also, have each of these virtual functionsprint something so you can see which is being called.○ (20 points) Write a main program that builds a list (or array) of severalinstances of each of your concrete classes, then pass this off to yourpolymorphic function.