The code below surprisingly compiles in VS 2012.
Method C::f() overrides methods in both base classes.
Is this standard behavior? I looked into C++11 standard, and didn't find any explicit mentioning of such situation.
class A { virtual void f() = 0; };
class B { virtual void f() = 0; };
class C : public A, public B {
virtual void f() override { }
};
Yes. The standard says, in C++11 10.3/2
There are no special cases for multiple base classes, so a function declared in the derived class will override a suitable function in all base classes.