Expected behavior
no compiler warning when deleting a BME280I2C object.
Actual behavior
warning: deleting object of polymorphic class type 'BME280I2C' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
delete BME280;
^~~~~~
Steps to reproduce the behavior
BME280I2C *BME280;
BME280 = new BME280I2C();
// ...
delete BME280;
Solution to avoid compiler warning
add virtual destructor in BME280I2C.h:
virtual ~BME280I2C(){}
Expected behavior
no compiler warning when deleting a BME280I2C object.
Actual behavior
warning: deleting object of polymorphic class type 'BME280I2C' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]
delete BME280;
^~~~~~
Steps to reproduce the behavior
Solution to avoid compiler warning
add virtual destructor in BME280I2C.h:
virtual ~BME280I2C(){}