Linked question is not the same - and does not even mention override
Edit: The new list of duplicates contains one legitimate duplicate, which I did not find from search.
I was not aware prior to asking this that the choice of whether or not to use virtual
in derived class members was going to be a contentious issue for some.
I have just encountered some source code which looks like this:
class A
{
virtual void method();
};
class B : public A
{
void method() override;
}
I am unsure of how to interpret this, even after reading this.
Does override
imply virtual
here? void B::method()
is not marked as a virtual function, but it is marked as override
. So why does this work, and not result in a compilation error?
Is there any difference between the following? (In class B
)
void method() override;
virtual void method() override;