D
Dasuraga
I'm rather new to the object-oriented aspects of C++, and this is the
first time I've had to construct some classes with multiple
inheritance. I'd rather not make a variable just to identify what type
an object is (leading to using a case, which somewhat defeats the
utility of derived classes). So, here's my problem. I have a couple
classes in this layout(simplistically):
class A{
void f()=0;
}
class B:virtual public A{
void f();
}
class C:virtual public A{
void f();
}
class D:virtual public A{
void f();
}
class E:virtual public B,virtual public C{};
class F:virtual public B,virtual public D{};
So, is there a way to make it so that E::f() automatically invokes
B::f(), then C::f()( similarly for F::f())? If not, is there a better
layout that you might be able to suggest?
first time I've had to construct some classes with multiple
inheritance. I'd rather not make a variable just to identify what type
an object is (leading to using a case, which somewhat defeats the
utility of derived classes). So, here's my problem. I have a couple
classes in this layout(simplistically):
class A{
void f()=0;
}
class B:virtual public A{
void f();
}
class C:virtual public A{
void f();
}
class D:virtual public A{
void f();
}
class E:virtual public B,virtual public C{};
class F:virtual public B,virtual public D{};
So, is there a way to make it so that E::f() automatically invokes
B::f(), then C::f()( similarly for F::f())? If not, is there a better
layout that you might be able to suggest?