View mode: basic / threaded / horizontal-split · Log in · Help
April 20, 2005
private static bug
<other.d>
class MyClass
{
static:

private int _staticVariable;
}

<main.d>
void test()
{
MyClass mc = new MyClass();
mc._staticVariable;//NOT accessible (correct)
MyClass._staticVariable;//IS accessible (bug in compiler)
return;
}

As you can see from this example, private static variables can still be accessed
from outside the module, if the private static is called from its class.
Top | Discussion index | About this forum | D home