Pure Abs\ act Bast Class Project Define a pure abstract base class ca lled Basic
ID: 3626404 • Letter: P
Question
Pure Abs act Bast Class ProjectDefine a pure abstract base class ca lled BasicShape. The Baaicshape 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 rerum the value in the member variable area.
calcArea. This function should be a pure virrual function.
Next, define a class named Circle. It should be derived from the Basicshape class.
It should have the fo llowing 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.
Explanation / Answer
class BasicShape { private: double area; public: double getArea() {return area;} virtual double calcArea() = 0; }; class Circle : public BasicShape { private: long int centerX, centerY; double radius; };
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.