The following code generates warning C4250. My question is, what's the best solution to it?
class A
{
virtual void func1();
}
class B : public A
{
}
class C : public A
{
virtual void func1();
}
class D : public B, public C
{
}
int main()
{
D d;
d.func1(); // Causes warning
}
According to what I've read it should be possible to do this:
class D : public B, public C
{
using B::func1();
}
But, this doesn't actually do anything. The way I've currently solved it is:
class D : public B, public C
{
virtual void func1() { B::func1(); }
}
What's everyone's view on this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…