Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 13 / Figures / Shape.cpp
diff options
context:
space:
mode:
Commit8cf1283a4ffb9fe1901c29c087fa376de82726af (patch)
Author
 angeld55 <angel_dimitriev@abv.bg>
2022-02-19 23:30:52 +0200
Committer
 angeld55 <angel_dimitriev@abv.bg>
2022-02-19 23:30:52 +0200
Filesabdfe6bf526100dcce87a88563100e02adf7605e /Sem. 13/Figures/Shape.cpp
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.tar
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.tar.gz
Object-oriented_programming_FMI-8cf1283a4ffb9fe1901c29c087fa376de82726af.zip
Parentd73a7ec225516657dec74472a0491330e9999217 (diff)
clean up
1 files changed, 0 insertions, 52 deletions
-rw-r--r--Sem. 13/Figures/Shape.cpp52
diff --git a/Sem. 13/Figures/Shape.cpp b/Sem. 13/Figures/Shape.cpp
deleted file mode 100644
index 27bb9e9..0000000
--- a/Sem. 13/Figures/Shape.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "Shape.h"
-
-Shape::Shape(size_t pointsCount) : pointsCount(pointsCount)
-{
- points = new point[pointsCount]; // [0,0], [0,0]....
-}
-
-void Shape::copyFrom(const Shape& other)
-{
- points = new point[other.pointsCount];
-
- for (int i = 0; i < other.pointsCount; i++)
- points[i] = other.points[i];
-}
-void Shape::free()
-{
- delete[] points;
-}
-
-Shape::Shape(const Shape& other)
-{
- copyFrom(other);
-}
-Shape& Shape::operator= (const Shape& other)
-{
- if (this != &other)
- {
- free();
- copyFrom(other);
- }
- return *this;
-}
-Shape::~Shape()
-{
- free();
-}
-
-const Shape::point& Shape::getPointAtIndex(size_t index) const
-{
- if (index >= pointsCount)
- throw std::exception("Invalid point index!");
-
- return points[index];
-}
-
-void Shape::setPoint(size_t pointIndex, int x, int y)
-{
- if (pointIndex >= pointsCount)
- throw std::exception("Invalid point index!");
-
- points[pointIndex] = point(x, y);
-}