diff options
| author | Syndamia <kamen@syndamia.com> | 2024-05-10 11:33:35 +0300 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2024-05-10 11:33:35 +0300 |
| commit | 66a5cdf79a8324019d9d34055ad212ad52504e3c (patch) | |
| tree | 309d7d6acc99ef6de8cff5ad18e2533572bc348f | |
| parent | 7b19cabee8b08478f31f6e4594ed28e1d04e153c (diff) | |
| download | oop-2023-solutions-66a5cdf79a8324019d9d34055ad212ad52504e3c.tar oop-2023-solutions-66a5cdf79a8324019d9d34055ad212ad52504e3c.tar.gz oop-2023-solutions-66a5cdf79a8324019d9d34055ad212ad52504e3c.zip | |
[w11] Fixes for destructors
| -rw-r--r-- | week11/Exercise02/Employee.h | 5 | ||||
| -rw-r--r-- | week11/Exercise03/Electronics.h | 4 | ||||
| -rw-r--r-- | week11/Exercise04/String.h | 2 | ||||
| -rw-r--r-- | week11/Exercise08/Link.h | 2 | ||||
| -rw-r--r-- | week11/Exercise09/DirectConcat.hpp.gch | bin | 2106544 -> 0 bytes |
5 files changed, 10 insertions, 3 deletions
diff --git a/week11/Exercise02/Employee.h b/week11/Exercise02/Employee.h index 7be3574..086f65d 100644 --- a/week11/Exercise02/Employee.h +++ b/week11/Exercise02/Employee.h @@ -7,4 +7,9 @@ protected: char name[512]; char position[128]; char department[64]; + +public: + // Може да имаме полиморфизъм, затова се нуждаем от виртуален деструктор + // В бъдеще ще използваме = default вместо {} + virtual ~Employee() {}; }; diff --git a/week11/Exercise03/Electronics.h b/week11/Exercise03/Electronics.h index 9f3d849..7dc9b9a 100644 --- a/week11/Exercise03/Electronics.h +++ b/week11/Exercise03/Electronics.h @@ -1,10 +1,12 @@ #pragma once -class Electroics { +class Electronics { char model[256]; float needsVolts; float needsAmps; public: + virtual ~Electronics() = default; + virtual void Print(); }; diff --git a/week11/Exercise04/String.h b/week11/Exercise04/String.h index 13481a0..bf7e77a 100644 --- a/week11/Exercise04/String.h +++ b/week11/Exercise04/String.h @@ -8,7 +8,7 @@ class String { public: String(); - ~String(); + virtual ~String(); String(const String& other); String& operator=(const String& other); String(String&& other); diff --git a/week11/Exercise08/Link.h b/week11/Exercise08/Link.h index 4acb312..4ad3f6c 100644 --- a/week11/Exercise08/Link.h +++ b/week11/Exercise08/Link.h @@ -9,7 +9,7 @@ class Link : public Message { public: Link(); - virtual ~Link() override; + ~Link(); Link(const Link& other); Link& operator=(const Link& other); Link(Link&& other); diff --git a/week11/Exercise09/DirectConcat.hpp.gch b/week11/Exercise09/DirectConcat.hpp.gch Binary files differdeleted file mode 100644 index d7e6e3f..0000000 --- a/week11/Exercise09/DirectConcat.hpp.gch +++ /dev/null |
