From c37cff5399140f5a6130604a04e9051deb97a61e Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Wed, 27 Sep 2023 10:01:50 +0200 Subject: [PATCH] Added missing virtual destructors --- api/Print.h | 2 ++ api/Printable.h | 1 + api/String.h | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/Print.h b/api/Print.h index 5a19fe78..3621d6e4 100644 --- a/api/Print.h +++ b/api/Print.h @@ -42,6 +42,8 @@ class Print void setWriteError(int err = 1) { write_error = err; } public: Print() : write_error(0) {} + virtual ~Print() {} + int getWriteError() { return write_error; } void clearWriteError() { setWriteError(0); } diff --git a/api/Printable.h b/api/Printable.h index 972866e8..cc45dc3f 100644 --- a/api/Printable.h +++ b/api/Printable.h @@ -33,6 +33,7 @@ class Print; class Printable { public: + virtual ~Printable() {} virtual size_t printTo(Print& p) const = 0; }; diff --git a/api/String.h b/api/String.h index 0bafd35a..fcd29211 100644 --- a/api/String.h +++ b/api/String.h @@ -81,7 +81,7 @@ class String explicit String(unsigned long, unsigned char base=10); explicit String(float, unsigned char decimalPlaces=2); explicit String(double, unsigned char decimalPlaces=2); - ~String(void); + virtual ~String(void); // memory management // return true on success, false on failure (in which case, the string