1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
class Square : public Shape
{
Point bLeft, tLeft, tRight, bRight;
double side1, side2, side3, side4;
public:
Square();
Square(double &s1, double &s2, double &s3, double &s4) : side1(s1), side2(s2), side3(s3), side4(s4)
{}
double getArea();
double getPer();
void display();
//void boundBox();
};
Square::Square(s1, s2, s3, s4)
{
bLeft(0,0);
tLeft(bLeft.getX(), bLeft.getY() + side1);
tRight(tLeft.getX() + side2, tLeft.getY());
bRight(tRight.getX(), tRight.getY() - side3);
}
int main()
{
//****sides for square
double side_s1 = 25;
double side_s2 = 25;
double side_s3 = 25;
double side_s4 = 25;
Square call_s(side_s1, side_s2, side_s3, side_s4);
call_s.display();
|