Accessibility, Visibility and Transparency
Posted by: IKVM.NET Weblog,
on 19 Dec 2011 |
View original | Bookmarked: 0 time(s)
There are a couple of subtle differences between the JVM and CLR with respect to member
accessibility. For example, the JVM will allow you to access public members in non-public
base classes:
package p1;
class Base {
public int foo;
}
public class Derived extends Base {
}
package p2;
class Test {
public static void main(String[] args) {
p1.Derived d = new p1.Derived();
d.foo = 42;
}
}
If you compile...