Question: Create two classes in separate files: 1. Class circle with property radius (1 point) and appropriate accessor and mutator functions (1 points), and a function

Create two classes in separate files:

1. Class circle with property radius (1 point) and appropriate accessor and mutator functions (1 points), and a function area that calculates the area of the circle.(1 point) 2. Class cylinder with property length that is derived from circle and with property length (1 point), appropriate accessor and mutator functions (1 points) and overrides the function area to calculate the area of the cylinder (1 point).

Test all functionality on both classes. (2 point)

Provide the source code with a comment containing your name, course code and date (1 point). Also provide a screenshot of a sample run. (1 point)

Submit the source code and screenshot in a zip file.

Create an array of pointers to the base class (Circle) of size 4, make area() a virtual function, allocate two objects of class circle and two of class cylinder, assign them to each element in the array and invoke area() for each element in the array (preferably using a loop). (Extra 10 points)

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!