Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need c++ programming with output Pure Abstract Base Class Project. Define a class called BasicShape which will be a pure abstract class. The class

I need c++ programming with output

Pure Abstract Base Class Project. Define a class called BasicShape which will be a pure abstract class. The class will have one protected data member that will be a double called area. It will provide a function called getArea which should return the value of the data member area. It will also provide a function called calcArea which must be a pure virtual function.

Define a class called Circle. It should be a derived class of the BasicShape class. This class will have 3 private data members. It will have 2 long integer data members called centerX and centerY. The last data member is a double called radius. It will have a constructor that accepts values for centerX, centerY and radius. This constructor should call the overridden calcArea function of this class. This class defines its version of the calcArea function which determines the area of the circle using the formula area = 3.14159 * radius * radius. The class will also provide two functions called getCenterX and getCenterY which return the correct values.

Define a class called Rectangle. It should be a derived class of the BasicShape class. This class will have 2 private data members called width and length. Both data members should be long integers. Its constructor will have parameters for both the width and length. It will also override the calcArea function. For this class the calcArea function will use the formula area = length * width. It will provide member function called getWidth and getLength which should return the correct values.

In main create instances of the Circle and Rectangle classes. It should then display the area of the two shapes using a function defined as

void DisplayArea(BasicShape* shape)

** I found other programs too for the same question, but there is no .cpp file for BasicShape class. Why is that?**

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago