aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--week-3/Persoon.cpp5
-rw-r--r--week-3/Persoon.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/week-3/Persoon.cpp b/week-3/Persoon.cpp
index f66e1f9..d58028c 100644
--- a/week-3/Persoon.cpp
+++ b/week-3/Persoon.cpp
@@ -4,7 +4,12 @@ Persoon::Persoon() {
_beroep = NULL;
}
+Persoon::~Persoon() {
+ delete _beroep;
+}
+
void Persoon::setBeroep(IBeroep* beroep) {
+ delete _beroep;
_beroep = beroep;
}
diff --git a/week-3/Persoon.h b/week-3/Persoon.h
index 88c742d..32ff651 100644
--- a/week-3/Persoon.h
+++ b/week-3/Persoon.h
@@ -11,5 +11,6 @@ class Persoon {
virtual void setBeroep(IBeroep* beroep);
virtual std::string getBeroep();
Persoon();
+ virtual ~Persoon();
};