Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
