I have a class A that was inherited from class B. So the interface of class A contains some pure virtual functions of class B and some functions of class A. Now I need to make unit tests for class A, so wanna have some interface for class A that I can mock. So now I'm wondering if the given code is correct in C++14 and can it lead to UB:
class Base1 {
public:
virtual void func() = 0;
};
class Base2 {
public:
virtual void func() = 0;
};
class Derived : public Base1, public Base2 {
public:
void func() override { }
};
int main() {
Derived d;
d.func();
return 0;
}