"Christopher C. Stacy" <[EMAIL PROTECTED]> writes:
> Can someone explain to me in 60 words or less what is the general
> lossage with C++ multiple inheritance that is often alluded to?
> (I'm referring to a problem in the C++ world, although it doubtless
> has implications for FFI from Lisp.)
I think this refers to the fact that a pointer to the base class
portion of an object is not necessarily equal to the orginal
object pointer when multiple inheritance comes into play.
For example:
#include <cstdio>
struct A { int a; };
struct B { int b; };
struct C : A, B { int c; '};
int main()
{
C* c = new C;
::printf("a=%p\n", static_cast<A*>(c));
::printf("b=%p\n", static_cast<B*>(c));
::printf("c=%p\n", static_cast<C*>(c));
return 0;
}
prints
a=0x804b030
b=0x804b034
c=0x804b030
(...and similar with virtual base classes. IIRC, a vtable of such an
object, if it has one, does not consist of function pointers alone,
but also contains offsets to add to the `this' pointer when calling a
virtual function.)
It's not that big a problem in daily C++ practice, IMO and provided
you know what you are doing, as usual, but it certainly makes
interfacing with C++ more interesting.