mirror of
https://github.com/adafruit/Adafruit_Sensor.git
synced 2025-07-30 07:27:12 +02:00
add virtual destructor
base classes without virtual destructors risk undefined behavior if their children are deleted through a pointer to base. see https://isocpp.org/wiki/faq/virtual-functions#virtual-dtors
This commit is contained in:
@ -140,6 +140,7 @@ class Adafruit_Sensor {
|
|||||||
public:
|
public:
|
||||||
// Constructor(s)
|
// Constructor(s)
|
||||||
void constructor();
|
void constructor();
|
||||||
|
virtual ~Adafruit_Sensor() {}
|
||||||
|
|
||||||
// These must be defined by the subclass
|
// These must be defined by the subclass
|
||||||
virtual void enableAutoRange(bool enabled) {};
|
virtual void enableAutoRange(bool enabled) {};
|
||||||
|
Reference in New Issue
Block a user