From 7bc2ff167be2579c7cb4118a4c75aba2283714cc Mon Sep 17 00:00:00 2001
From: Aleksandar Karakas <aleksandar.karakas@tugraz.at>
Date: Thu, 25 Mar 2021 21:10:34 +0100
Subject: [PATCH] make destructor of base class virtual

---
 .../vo/stream-04-vererbung/2_pets_w_polymorphism/pet.hpp      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/2021-oop1/vo/stream-04-vererbung/2_pets_w_polymorphism/pet.hpp b/2021-oop1/vo/stream-04-vererbung/2_pets_w_polymorphism/pet.hpp
index 9a5c4cb..f06cc05 100644
--- a/2021-oop1/vo/stream-04-vererbung/2_pets_w_polymorphism/pet.hpp
+++ b/2021-oop1/vo/stream-04-vererbung/2_pets_w_polymorphism/pet.hpp
@@ -15,11 +15,11 @@ class Pet {
       strcpy(name_, name);
     }
     Pet(const Pet& other) = delete;
-    ~Pet() { delete[] name_; }
+    virtual ~Pet() { delete[] name_; }
     unsigned getAge() { return age_; }
     void setAge(unsigned age) { age_ = age; }
     // virtual void drink() = 0; // if we use this line instead of the next, Pet becomes an abstract class.
     virtual void drink() { printf("%s drinks.\n", name_); }
 };
 
-#endif
\ No newline at end of file
+#endif
-- 
GitLab