Wie werden vtables in c ++ und c # implementiert?

Lässt diese Situation haben (in c ++ sind in c # Klassen A, B Schnittstellen):

class A { virtual void func() = 0; };
class B { virtual void func() = 0; };
class X: public A, public B { virtual void func(){ var = 1; } int var;};

X * x = new X; // from what I know, x have 2 vtables, is this the same in c#?
A * a = (A*)x; // a == x
B * b = (B*)x; // here b != x, so when calling b->func(), how is the address of var correct?

Erstellt der c # -Compiler immer eine vtable? Führt es Zeigerkorrekturen beim Casting durch?

Antworten auf die Frage(8)

Ihre Antwort auf die Frage