I've written a base class with a virtual pure method and two derived classes that inherit this base class publicly. I used "override" to implement versions of the pure virtual of the abstract base class. In Xcode, and many other IDEs, there's usually a key command to hold down when clicking on a method declaration that will navigate you directly towards its definition. I feel as if that my virtual pure declaration is "linked" to my derived classes overriden methods because I'm able to navigate from the base class to the derived classes by using Command+click on the virtual pure declaration, however, I'm able to freely remove the "override" keyword and compile with no errors, when I always believed that "override" was necessary when implementing a definition for a pure virtual method. Any help explaining this would be great:
Here is the abstract base class:
class MillisecondsHertzValueBase
{
private:
// Removed code to reduce length
public:
MillisecondsHertzValueBase();
virtual ~MillisecondsHertzValueBase();
virtual void calculateValues (const double &input) = 0;
// Removed code to reduce length
};
Here is one of the derived classes header files, where I can freely remove the "override" keyword:
class MillisecondValues : public MillisecondsHertzValueBase
{
public:
~MillisecondValues();
void calculateValues (const double &input) override;
};
Here is the implementation:
MillisecondValues::~MillisecondValues() {}
void MillisecondValues::calculateValues (const double &input)
{
// Removed code to reduce length
}