Does D have too many features?
Jacob Carlborg
doob at me.com
Sun Apr 29 23:42:24 PDT 2012
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
More information about the Digitalmars-d
mailing list