Question: 2. Using the base class Shape shown below, implement the following functions for the two classes named Square and Circle. Save your program in a

 2. Using the base class Shape shown below, implement the following

2. Using the base class Shape shown below, implement the following functions for the two classes named Square and Circle. Save your program in a file called Q2.cpp and upload it to Question \#2 Square::Square(int s, string n): Shape( n ) double Square: :calcarea() Circle::Circle(int r, string nm ) : Shape(nm) double Circle: :calcarea() Include using namespace stdi const double p1 -3.14 ; class Shape 1 private: otring name : public: shape () ( name - "shape"; ) shape (string n) ( name = ni \} string getname () ( return (name) : ) virtual double calcarea () (return or ) if dasn square i public Shape i private: int side: poblica Square(int ad, string nm) ? // parameter ad is the sides parameter rim in the name of the shape double calcarea (); I) returns the value of side side It glase cirolet pubile shape private? int radius: publite: cirele (int rad, string nin); // parameter sd is the sider parameter nm is the name of the shape double calcarea (i) 17 If returns the value of pi*radius*radius

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!