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 9a5c4cbb1202bf7c2f12534d1848ea21780c561a..f06cc054a9e1147c00d1306669c8873c7ddd118c 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