On 2012-04-29 20:08, Manu wrote:

package confuses me, it's poorly documented. What are the protections
between packages, sub-packages. Can parent packages see sub-package
contents? vice-versa?

As far as I know it works like this:

pack
  |- pack1
    |- foo.d
    |- bar.d
      |- pack2
          |- a.d
  |- pack3
      |- b.d
  |- c.d

// pack.pack1.foo

package int x = 3;

// pack.pack1.bar

x = 4; // this is fine since it's in the same package.

// pack.pack1.pack2.a

x = 5; // error, cannot access package protected variable.

// pack.pack3.b

x = 6; // error, cannot access package protected variable.

// pack.c

x = 7; // error, cannot access package protected variable.

Oh, and "package" is non-virtual, for some reason.

--
/Jacob Carlborg

Reply via email to