static data in a sub-class

Steve D whatchcallamit at weedline.com
Sat Dec 22 12:44:33 PST 2012


Hello,
How can I get class B's array printed, using inherited A's 
function? (Dmd 2.060)

     class A {
         static float[3] hi = 1;

         void f() { writefln("hi %s",hi); }
     }

     class B : A {
         static float[3] hi = 2;
     }

     B b = new B();
     b.f();     // prints 'hi [1,1,1]'
                // can I get it to use B's overridden hi: [2,2,2] ?

Thanks for your help :)
Steve


More information about the Digitalmars-d-learn mailing list