neutronimaging / imagingsuite

Sources for imaging related tools
GNU General Public License v3.0
18 stars 9 forks source link

Add override declarations for virtual functions #701

Closed anderskaestner closed 1 week ago

anderskaestner commented 1 week ago

As in the example

#include <iostream>
#include <string>

// Step 1: Base class with a virtual function
class Animal {
public:
    virtual std::string Speak() const {
        return "Some generic animal sound";
    }

    virtual ~Animal() = default; // Virtual destructor for proper cleanup
};

// Step 2: Derived class
class Dog : public Animal {
public:
    // Step 3: Override the virtual function
    std::string Speak() const override {
        return "Woof";
    }
};