From cbe098fdaf6509b6a3c8bd33b3064d8f620dd58c Mon Sep 17 00:00:00 2001 From: angeld55 Date: Fri, 28 May 2021 16:45:24 +0300 Subject: sem 14 --- Sem. 14/Shapes/Square.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Sem. 14/Shapes/Square.cpp (limited to 'Sem. 14/Shapes/Square.cpp') diff --git a/Sem. 14/Shapes/Square.cpp b/Sem. 14/Shapes/Square.cpp new file mode 100644 index 0000000..555c340 --- /dev/null +++ b/Sem. 14/Shapes/Square.cpp @@ -0,0 +1,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; +} \ No newline at end of file -- cgit v1.3.1-23-gd82d