private keyword dont appear to do anything
LunaticWare
exemple at gmail.com
Fri Nov 3 12:39:21 UTC 2017
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
More information about the Digitalmars-d-learn
mailing list