On 29/03/2017 10:50 AM, abad wrote:
This works:
class Foo {
protected void bar() {
writeln("hello from foo");
}
}
void main() {
auto foo = new Foo;
foo.bar();
}
Is this on purpose and what's the rationale?
http://dlang.org/spec/attribute.html#visibility_attributes
"protected only applies inside classes (and templates as they can be
mixed in) and means that a symbol can only be seen by members of the
same module, or by a derived class. If accessing a protected instance
member through a derived class member function, that member can only be
accessed for the object instance which can be implicitly cast to the
same type as ‘this’. protected module members are illegal."