Pure Abstract Base Class ProjectDefine a pure abstract base class called BasicShape. The BasicShape class shouldhave the following members:Private Member Variable:area, a double used to hold the shape's area.Public Member Functions:getArea. This function should return the value in the member variable area.calcArea. This function should be a pure virtual function.Next, define a class named Circle. It should be derived from the BasicShape class. Itshould have the following members:Private Member Variables:centerX, a long integer used to hold the x coordinate of the circle’s center.centerY, a long integer used to hold the y coordinate of the circle’s center.radius, a double used to hold the circle's radius.Public Member Functions:constructor—accepts values for centerX, centerY, and radius. Should callthe overridden calcArea function described below.getCenterX—returns the value in centerX.getCenterY—returns the value in centerY.calcArea—calculates the area of the circle (area = 3.14159 * radius * radius)and stores the result in the inherited member area.Next, define a class named Rectangle. It should be derived from the BasicShapeclass. It should have the following members:Private Member Variables:width, a long integer used to hold the width of the rectangle.length, a long integer used to hold the length of the rectangle.Public Member Functions:constructor—accepts values for width and length. Should call the overriddencalcArea function described below.getWidth—returns the value in width.getLength—returns the value in length.calcArea—calculates the area of the rectangle (area = length * width) and storesthe result in the inherited member area. After you have created these classes, create a driver program that defines a Circleobject and a Rectangle object. Demonstrate that each object properly calculates andreports its area.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Pure Abstract Base Class Project
Define a pure abstract base class called BasicShape. The BasicShape class should
have the following members:
Private Member Variable:
area, a double used to hold the shape's area.
Public Member Functions:
getArea. This function should return the value in the member variable area.
calcArea. This function should be a pure virtual function.
Next, define a class named Circle. It should be derived from the BasicShape class. It
should have the following members:
Private Member Variables:
centerX, a long integer used to hold the x coordinate of the circle’s center.
centerY, a long integer used to hold the y coordinate of the circle’s center.
radius, a double used to hold the circle's radius.
Public Member Functions:
constructor—accepts values for centerX, centerY, and radius. Should call
the overridden calcArea function described below.
getCenterX—returns the value in centerX.
getCenterY—returns the value in centerY.
calcArea—calculates the area of the circle (area = 3.14159 * radius * radius)
and stores the result in the inherited member area.
Next, define a class named Rectangle. It should be derived from the BasicShape
class. It should have the following members:
Private Member Variables:
width, a long integer used to hold the width of the rectangle.
length, a long integer used to hold the length of the rectangle.
Public Member Functions:
constructor—accepts values for width and length. Should call the overridden
calcArea function described below.
getWidth—returns the value in width.
getLength—returns the value in length.
calcArea—calculates the area of the rectangle (area = length * width) and stores
the result in the inherited member area.

After you have created these classes, create a driver program that defines a Circle
object and a Rectangle object. Demonstrate that each object properly calculates and
reports its area.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY