[Issue 19334] Derived class inheritance private members in same module

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 25 23:04:04 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19334

--- Comment #1 from alexanderheistermann at gmail.com ---
Scratch that, it still accepts invalid code even package int x is removed.
Class b shouldn't have property y, as property y only exist at class A not
class B.

import std.stdio;
class A
{
    private int y;
}

class B : A
{
};

void main()
{
    B b = new B();
    b.y = 1; // Should be a compile error as class shouldn't have private int
y.
    writeln(b.y);
}

--


More information about the Digitalmars-d-bugs mailing list