Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 14 / Shapes / Square.cpp
blob: 555c3402cd3d1e3773a994ee8c9fba2b651c497f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "Square.h"

Square::Square(double x, double y, double sideLength) : Rectangle(x, y, x + sideLength, y - sideLength), Rhombus(x, y, x, y - sideLength), Shape(4)
{}

double Square::getArea() const
{
	return Rhombus::getArea();
}
double Square::getPer() const
{
	return Rectangle::getPer();
};

Shape* Square::clone() const
{
	Square* copy = new Square(*this);
	return copy;
}