Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Add a second class called RegularPolygon, which will inherit the characteristics of the Figure class. Add the following elements. Attributes: - - apothem - -
Add a second class called RegularPolygon, which will inherit the characteristics of the Figure class. Add the following elements.
Attributes:
apothem
sidemeasurement
Methods:
get and set the two attributes
calculate perimeter
calculate area
Add an example of an octagon and a pentagon to the main file.
Here is the code to complete.
Figure.h
#ifndef FIGUREH
#define FIGUREH
#include
using namespace std;
class figure
public:
overload
Figure;
Figurestring int;
virtual ~Figure;
void setNamestring;
string getName;
void setNoSidesint;
int getNoSides;
protected:access to your children's class
string name;
int noSides;
private:
;
#endif FIGUREH
Figure.cpp
#include "Figure.h
Figure::Figure
noSides;
nameND;
Figure::Figurestring x int y
noSidesy;
namex;
Figure::~Figure
doctor
void figure::setNamestring x
namex;
string Figure::getName
return name;
void figure::setNoSidesint x
noSidesx;
int Figure::getNoSides
return noSides;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started