Skip to content

Commit

Permalink
Use virtual destructor in polymorphic base classes
Browse files Browse the repository at this point in the history
In order to be able to use classes such as `isobus::CANHardwarePlugin`
polymophically C++ requires a `virtual` destructor in the base class.
This ensures that, when the pointer to base is destroyed, that it will
correctly call the derived destructors as well.
  • Loading branch information
bigdavedev authored and GwnDaan committed Jan 14, 2025
1 parent 4ad8020 commit ffd6bb9
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ namespace isobus
class CANHardwarePlugin
{
public:
virtual ~CANHardwarePlugin() = default;

/// @brief Returns if the driver is ready and in a good state
/// @details This should return `false` until `open` is called, and after `close` is called, or
/// if anything happens that causes the driver to be invalid, like the hardware is disconnected.
Expand Down

0 comments on commit ffd6bb9

Please sign in to comment.