From 54f265afb8a9f27a05a287116379e6f829560e6c Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 26 May 2013 02:14:45 +0300 Subject: [PATCH] Negation contains a pointer and needs copy c'tor and operator= --- source/geometry/negation.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source/geometry/negation.h b/source/geometry/negation.h index c01763d..ce2f787 100644 --- a/source/geometry/negation.h +++ b/source/geometry/negation.h @@ -18,6 +18,9 @@ private: public: Negation(const Shape &); + Negation(const Negation &); + Negation &operator=(const Negation &); + ~Negation(); virtual Negation *clone() const; @@ -34,6 +37,25 @@ inline Negation::Negation(const Shape &s): shape(s.clone()) { } +template +inline Negation::Negation(const Negation &other): + shape(other.shape->clone()) +{ } + +template +inline Negation &Negation::operator=(const Negation &other) +{ + delete shape; + shape = other.shape->clone(); + return *this; +} + +template +inline Negation::~Negation() +{ + delete shape; +} + template inline Negation *Negation::clone() const { -- 2.43.0