M
mike
Hello fellow C++ experts,
is there any dramatic difference between multiple inheritance:
struct MyType4 : MyType1, MyType2, MyType3 {
int MyInt;
};
and:
struct MyType4 {
MyType1 MyObject1;
MyType2 MyObject2;
MyType3 MyObject3;
int MyInt;
};
?
Is just neat sintactic sugar, or is there something that is impossible
to be achieved with the 2nd solution?
I mean, a function accepting a pointer to MyType2 can accept also a
pointer to a MyType4 object, and that's neat, but I could always pass
&MyObject4.MyObject2 to that function (2nd solution without multiple
inheritance), producing the same result (at least I think). Hence my
question "Is just neat sintactic sugar, or..".
Thanks,
Mike
is there any dramatic difference between multiple inheritance:
struct MyType4 : MyType1, MyType2, MyType3 {
int MyInt;
};
and:
struct MyType4 {
MyType1 MyObject1;
MyType2 MyObject2;
MyType3 MyObject3;
int MyInt;
};
?
Is just neat sintactic sugar, or is there something that is impossible
to be achieved with the 2nd solution?
I mean, a function accepting a pointer to MyType2 can accept also a
pointer to a MyType4 object, and that's neat, but I could always pass
&MyObject4.MyObject2 to that function (2nd solution without multiple
inheritance), producing the same result (at least I think). Hence my
question "Is just neat sintactic sugar, or..".
Thanks,
Mike