B
bergel
Hello,
Regarding the variable layout with multi inheritance, I looked into a
couple of C++ books but I was not able to find a descent answer.
Let assume I have the following:
class A{
int x;
}
int A::getX(){ return x;}
class B{
int y;
}
int B::getY(){ return y;}
class C: virtual A, virtual B {
}
In A the offset of x is 0. Same thing for B, the offset of y is 0.
But what is the variable layout of C?
If x'offset = 0 and y's offset = 1, what's happen with the getY()
method ? Is it duplicated to take the new offset into account ? Or is
there any dynamic lookup of variables ?
Cheers,
Alexandre
Regarding the variable layout with multi inheritance, I looked into a
couple of C++ books but I was not able to find a descent answer.
Let assume I have the following:
class A{
int x;
}
int A::getX(){ return x;}
class B{
int y;
}
int B::getY(){ return y;}
class C: virtual A, virtual B {
}
In A the offset of x is 0. Same thing for B, the offset of y is 0.
But what is the variable layout of C?
If x'offset = 0 and y's offset = 1, what's happen with the getY()
method ? Is it duplicated to take the new offset into account ? Or is
there any dynamic lookup of variables ?
Cheers,
Alexandre