www.digitalmars.com         C & C++   DMDScript  

D - Restrincting access modifiers on base classes.

The Java compiler will produce an error on the following file:

public class A
{
    public void doit() { }
}


class B extends A
{
    private void doit() { }
}

 javac A.java

weaker access privileges; was public private void doit() { } ^ The equivalent code compiles just fine in DMD 0.82 but it seems wrong to me. "B" it's not an "A" anymore because it doesn't implement A's public interface from the perspective of other modules. Is this by design? Haven't been able to find any compeling reason. Thanks -- Julio CÚsar Carrascal Urquijo.
Apr 16 2004