Private static inheritance
Matti Niemenmaa
see_signature at for.real.address
Sun Sep 23 05:39:06 PDT 2007
David Ferenczi wrote:
> I've come accross with the following:
>
> test.d
> -------------8<------------------
>
> module test;
>
> static private import testAA: AA;
> static private import std.cstream: dout;
>
> int main(char[][] args)
> {
> dout.writeLine(AA.text);
> return 0;
> }
>
> -------------8<------------------
>
>
>
> testA.d
> -------------8<------------------
>
> module testA;
>
> class A
> {
> private:
> static const char[] text = "text";
> }
>
> -------------8<------------------
>
>
>
> testAA.d
> -------------8<------------------
>
> module testAA;
>
> static private import testA: A;
>
> class AA : A
> {
> }
>
> -------------8<------------------
>
>
> Running the program the output is: "text"
>
>
> I don't know what would be the correct behaviour, but I presume that a
> private member (even if it's static) can't be accessed either from outside,
> neither from a subclass. Am I wrong?
Looks like good old bug 314 to me: http://d.puremagic.com/issues/show_bug.cgi?id=314
--
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi
More information about the Digitalmars-d-learn
mailing list