Question: Hi, need your help on my C++ programming subject: Write a class that extends the Polygon class from the previous laboratory exercise. The class will
Hi, need your help on my C++ programming subject:
Write a class that extends the Polygon class from the previous laboratory exercise. The class will represent a dodecagon. Initialize all the properties of the parent class in the new constructor.
below are my previous laboratory exercise (class polygon)
class Polygon
{
public:
string name, color;
int sides;
void printname();
void printcolor();
void printsides()
{
cout << "No. of Sides: " << sides;
}
};
void Polygon::printname(){
cout << "Polygon Name: "<< name;
}
void Polygon::printcolor(){
cout << "Color of Polygon: "<< color;
}
int main() {
Polygon Info;
Info.name="Triangle";
Info.sides=3;
Info.color="Blue";
Info.printname();
cout << endl;
Info.printcolor();
cout << endl;
Info.printsides();
cout << endl;
Thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
