Question: Create a simple program which uses a class hierarchy Class Hierarchy .Parent class: fruit o has these member variables protected string producing_area I1 e.g.,Hawaii, california,

 Create a simple program which uses a class hierarchy Class Hierarchy.Parent class: fruit o has these member variables protected string producing_area I1

Create a simple program which uses a class hierarchy Class Hierarchy .Parent class: fruit o has these member variables protected string producing_area I1 e.g.,Hawaii, california, ete float price; o has the following member function prototype: void printData ) note: only prototype in this class. You will define it for each child class. o must be an abstract class . Three different child classes o must be different specific fruits; member variables must have different values from those in other child classes must inherit void printData) and the function must print the following information. Name of the child class (name of fruit) A string stored in producing_area A value stored in price Each class must have its own.cpp and .h file, including constructors and destructors The main function Write a main function which performs the tollowing. Create instances of all the child classes. Create two data containers C++ has the standard template library (STL), offering a variety of data structures. Store addresses of your objects into vector and map as their parent class: fruit*. Research details of usage of these containers. o vector: it is a kind of dynamic array. Store your items dynamically by adding the address of each (fruit*)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!