xxxxxxxxxx
--- bar.d
module bar;
import foo;
class D : C
{
void example()
{
// ok - D inherits from C
this.fun();
}
}
void example()
{
auto c = new C;
// error - can't access C.fun here
c.fun();
}
--- foo.d
module foo;
class C
{
protected void fun()
{
import std.stdio: writeln;
writeln("fun");
}
}
void example()
{
auto c = new C;
// ok - C.fun is defined in this module
c.fun();
}