Alright, so I'm having issues compiling this program, and I only have one error and I've been stuck on it for hours trying different things. It says "no overloaded function takes two arguments" and it is referring to "Rectangle::Rectangle" in the file called "squaredefinition.h". It's on line 9. I'll post all the files below.
#include "SquareDeclaration.h"
#include <iostream>
usingnamespace std;
int main()
{
bool filled;
double a;
string color;
cout<<"Is the shape filled? If it is true, enter 1, otherwise, enter 0."<<endl;
cin>>filled;
cout<<"Enter the side of the square: "<<endl;
cout<<"a=";
cin>>a;
cout<<"Enter the color of the square: "<<endl;
cout<<"color=";
cin>>color;
if(filled)
{
cout<<"The shape is filled."<<endl;
}
else
{
cout<<"The shape is not filled."<<endl;
}
Square mySquare(filled, a, a, color);
cout<<"\nObject Square: a="<<mySquare.getLength()<<endl;
cout<<"Perimeter: "<<mySquare.getPerimeter()<<endl;
cout<<"Area: "<<mySquare.getArea()<<endl;
cout<<"Diagonal: "<<mySquare.getSquareDiagonal()<<endl;
cout<<"Color: "<<mySquare.getColor()<<endl;
cout<<endl;
system("pause");
return 0;
}
Rectangle only has two constructors; one taking no parameters and one taking three parameters:
1 2
Rectangle();
Rectangle(bool, double, double);
EDIT: By the way, there's no point in making Square inherit directly from both Rectangle and Shape. If you make Square inherit only from Rectangle then you're also making it inherit from Shape, indirectly.
A novice plumber was working on a house when the journeyman plumber came to see how it was going. "Great!" said the novice. "I just have this one pipe to solder and them I'm done." The journeyman watched as the novice finished the last pipe. "Now turn on the water," he said. The notice turned on the water and 30 leaks appeared.
I'm afraid that your one error is hiding 30. I tried fixing them but gave up after a while. The errors mostly stem from the fact that everything is in include files. If you break it up into separate header and cpp files, it's much better. This code compiles and runs. See "dmh" in the comments for the changes I had to make.