diff options
Update Shape.cpp
1 files changed, 3 insertions, 1 deletions
| -rw-r--r-- | Sem. 12/Example_polymorphism/Shape.cpp | 4 |
diff --git a/Sem. 12/Example_polymorphism/Shape.cpp b/Sem. 12/Example_polymorphism/Shape.cpp index 27bb9e9..468c621 100644 --- a/Sem. 12/Example_polymorphism/Shape.cpp +++ b/Sem. 12/Example_polymorphism/Shape.cpp @@ -8,9 +8,11 @@ Shape::Shape(size_t pointsCount) : pointsCount(pointsCount) void Shape::copyFrom(const Shape& other) { points = new point[other.pointsCount]; - + for (int i = 0; i < other.pointsCount; i++) points[i] = other.points[i]; + + pointsCount = other.pointsCount; } void Shape::free() { |
