View mode: basic / threaded / horizontal-split · Log in · Help
July 29, 2004
scope problems with private
D:\code\d>type test.d
D:\code\d>type test.d
template Templ(T)
{
class TemplA
{
private:
int val;
}

class TemplB
{
public:
this()
{
TemplA a = new TemplA();
a.val = 5;
}
}
}

class Class(T)
{
class ClassA
{
private:
int val;
}

this()
{
ClassA a = new ClassA();
a.val = 5; // failure is here
}
}

int main()
{
Templ!(int).TemplB tb = new Templ!(int).TemplB();
Class!(int) cb = new Class!(int)();
return 0;
}

D:\code\d>dmd test.d
test.d(31): class ClassA member val is not accessible
Top | Discussion index | About this forum | D home