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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started