hello, being new to D i assumed that the private keyword would work as in C++, but writing this code, i excepted it to throw an error at compile time, it appear to not doing anything, is there something i am doing wrong ?

------
import std.stdio;

class Foo
{
    private int id = 10;
}

struct Bar
{
    private int id = 20;
}

void main()
{
    auto foo = new Foo;
    Bar bar;

    foo.id = 15;
    bar.id = 25;

    writeln(foo.id);
    writeln(bar.id);
}

// RDMD OUTPUT
// 15
// 25

Reply via email to