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 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() Hinclude ciostreas. using nanespacel std? const double pi - 3.14 : class shape f privace: atring name: publite: Shape() ( name - "shape" t I Shape(string n) ( name: =n | ntring gethame () if return (nane) ; 1 virtual double calcareai) ir return of i 1; clant square i publlo shape 1 private: int sided public: squerelint sid, string nin); // paraneter sd is the side; paraneter nm is the nahe of the shape doable calcarea () : // returns the value of side * side Glasz Cirolet public shape T. Privatef int radtyer public: double calearea (i) 1; feterts she value of pirradiustradlus
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
