Hello,

I have code that has the following structure:

class XA { uint x; }
class XB : XA { uint y; }

class A
{
        XA xa;
        this() { xa.x = 2; }
}

class B
{
        XB xa;
        this() { xa.x = 3; xa.y = 4; }
}

void main() { B b = new B(); }

When I run, the statement that says "xa.x = 3" halts with
"object.Error: access violation". Why?

If I add "uint x" to XB, I get the same error. If I change the name
of "xa" in the class "B", I also get the same error.

I couldn't find anything in the documentation that explains how D
deals with fields in inherited classes. I'm using D2.

Regards,

Andr�

Reply via email to