Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

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

T Sql Fundamentals

Authors: Itzik Ben Gan

4th Edition

0138102104, 978-0138102104

More Books

Students also viewed these Databases questions

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago