When implementing a pure virtual function in C++, is there a best-practices guideline that says the implementation should also be made virtual? What is the rationale?
class Interface
{
  public:
    virtual void foobar() = 0;
};
class Concrete
    : public Interface
{
  public:
    virtual void foobar();
};
                It does not matter.
void foobar() in Concrete is virtual regardless whether you declare it as such and it overrides the void foobar() in Interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With